Fixed depracation of rewritten URL

This commit is contained in:
Franck Allimant
2014-01-20 23:38:14 +01:00
parent e05f836cbf
commit 66d6d03770

View File

@@ -225,8 +225,9 @@ trait UrlRewritingTrait {
}
/* deprecate the old one if needed */
$oldRewritingUrl = RewritingUrlQuery::create()->findOneByUrl($currentUrl);
$oldRewritingUrl->setRedirected($rewritingUrl->getId())->save();
if (null !== $oldRewritingUrl = RewritingUrlQuery::create()->findOneByUrl($currentUrl)) {
$oldRewritingUrl->setRedirected($rewritingUrl->getId())->save();
}
return $this;
}