Factorized URL desactivation in UrlRewritingTrait::markRewritenUrlObsolete()
This commit is contained in:
@@ -115,12 +115,7 @@ class Category extends BaseCategory
|
|||||||
*/
|
*/
|
||||||
public function postDelete(ConnectionInterface $con = null)
|
public function postDelete(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
RewritingUrlQuery::create()
|
$this->markRewritenUrlObsolete();
|
||||||
->filterByView($this->getRewrittenUrlViewName())
|
|
||||||
->filterByViewId($this->getId())
|
|
||||||
->update(array(
|
|
||||||
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,12 +148,7 @@ class Content extends BaseContent
|
|||||||
|
|
||||||
public function postDelete(ConnectionInterface $con = null)
|
public function postDelete(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
RewritingUrlQuery::create()
|
$this->markRewritenUrlObsolete();
|
||||||
->filterByView($this->getRewrittenUrlViewName())
|
|
||||||
->filterByViewId($this->getId())
|
|
||||||
->update(array(
|
|
||||||
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONTENT, new ContentEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONTENT, new ContentEvent($this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,12 +100,7 @@ class Folder extends BaseFolder
|
|||||||
|
|
||||||
public function postDelete(ConnectionInterface $con = null)
|
public function postDelete(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
RewritingUrlQuery::create()
|
$this->markRewritenUrlObsolete();
|
||||||
->filterByView($this->getRewrittenUrlViewName())
|
|
||||||
->filterByViewId($this->getId())
|
|
||||||
->update(array(
|
|
||||||
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEFOLDER, new FolderEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETEFOLDER, new FolderEvent($this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,12 +263,7 @@ class Product extends BaseProduct
|
|||||||
*/
|
*/
|
||||||
public function postDelete(ConnectionInterface $con = null)
|
public function postDelete(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
RewritingUrlQuery::create()
|
$this->markRewritenUrlObsolete();
|
||||||
->filterByView($this->getRewrittenUrlViewName())
|
|
||||||
->filterByViewId($this->getId())
|
|
||||||
->update(array(
|
|
||||||
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETEPRODUCT, new ProductEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETEPRODUCT, new ProductEvent($this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ use Thelia\Exception\UrlRewritingException;
|
|||||||
use Thelia\Model\RewritingUrlQuery;
|
use Thelia\Model\RewritingUrlQuery;
|
||||||
use Thelia\Model\RewritingUrl;
|
use Thelia\Model\RewritingUrl;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
/**
|
/**
|
||||||
* A trait for managing Rewritten URLs from model classes
|
* A trait for managing Rewritten URLs from model classes
|
||||||
*/
|
*/
|
||||||
@@ -136,6 +137,18 @@ trait UrlRewritingTrait {
|
|||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark the current URL as obseolete
|
||||||
|
*/
|
||||||
|
public function markRewritenUrlObsolete() {
|
||||||
|
RewritingUrlQuery::create()
|
||||||
|
->filterByView($this->getRewrittenUrlViewName())
|
||||||
|
->filterByViewId($this->getId())
|
||||||
|
->update(array(
|
||||||
|
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the rewritten URL for the given locale
|
* Set the rewritten URL for the given locale
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user