Merge branch 'master' of github.com:thelia/thelia into cleanmaster

This commit is contained in:
Etienne Roudeix
2013-12-09 10:29:49 +01:00
9 changed files with 737 additions and 376 deletions

View File

@@ -107,7 +107,7 @@ final class TheliaEvents
/**
* sent just before customer removal
*/
const BEFORE_DELETECUSTOMER = "action.before_updateCustomer";
const BEFORE_DELETECUSTOMER = "action.before_deleteCustomer";
/**
* sent just after customer removal
@@ -121,7 +121,7 @@ final class TheliaEvents
const ADDRESS_CREATE = "action.createAddress";
/**
* sent for address creation
* sent for address modification
*/
const ADDRESS_UPDATE = "action.updateAddress";
@@ -135,7 +135,14 @@ final class TheliaEvents
*/
const ADDRESS_DEFAULT = "action.defaultAddress";
/**
* sent once the address creation form has been successfully validated, and before address insertion in the database.
*/
const BEFORE_CREATEADDRESS = "action.before_createAddress";
/**
* Sent just after a successful insert of a new address in the database.
*/
const AFTER_CREATEADDRESS = "action.after_createAddress";
const BEFORE_UPDATEADDRESS = "action.before_updateAddress";

View File

@@ -115,12 +115,7 @@ class Category extends BaseCategory
*/
public function postDelete(ConnectionInterface $con = null)
{
RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($this->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
$this->markRewritenUrlObsolete();
$this->dispatchEvent(TheliaEvents::AFTER_DELETECATEGORY, new CategoryEvent($this));
}

View File

@@ -148,12 +148,7 @@ class Content extends BaseContent
public function postDelete(ConnectionInterface $con = null)
{
RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($this->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
$this->markRewritenUrlObsolete();
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONTENT, new ContentEvent($this));
}

View File

@@ -100,12 +100,7 @@ class Folder extends BaseFolder
public function postDelete(ConnectionInterface $con = null)
{
RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($this->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
$this->markRewritenUrlObsolete();
$this->dispatchEvent(TheliaEvents::AFTER_DELETEFOLDER, new FolderEvent($this));
}

View File

@@ -263,12 +263,7 @@ class Product extends BaseProduct
*/
public function postDelete(ConnectionInterface $con = null)
{
RewritingUrlQuery::create()
->filterByView($this->getRewrittenUrlViewName())
->filterByViewId($this->getId())
->update(array(
"View" => ConfigQuery::getObsoleteRewrittenUrlView()
));
$this->markRewritenUrlObsolete();
$this->dispatchEvent(TheliaEvents::AFTER_DELETEPRODUCT, new ProductEvent($this));
}

View File

@@ -31,6 +31,7 @@ use Thelia\Model\RewritingUrlQuery;
use Thelia\Model\RewritingUrl;
use Thelia\Rewriting\RewritingResolver;
use Thelia\Tools\URL;
use Thelia\Model\ConfigQuery;
/**
* A trait for managing Rewritten URLs from model classes
*/
@@ -138,6 +139,18 @@ trait UrlRewritingTrait {
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
*