dispatch event in pre/post crud method for content model
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Thelia\Core\Event\Content\ContentEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Model\Base\Content as BaseContent;
|
use Thelia\Model\Base\Content as BaseContent;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
@@ -43,6 +45,37 @@ class Content extends BaseContent
|
|||||||
{
|
{
|
||||||
$this->setPosition($this->getNextPosition());
|
$this->setPosition($this->getNextPosition());
|
||||||
|
|
||||||
|
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECONTENT, new ContentEvent($this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function postInsert(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$this->dispatchEvent(TheliaEvents::AFTER_CREATECONTENT, new ContentEvent($this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preUpdate(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$this->dispatchEvent(TheliaEvents::BEFORE_UPDATECONTENT, new ContentEvent($this));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postUpdate(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$this->dispatchEvent(TheliaEvents::AFTER_UPDATECONTENT, new ContentEvent($this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preDelete(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECONTENT, new ContentEvent($this));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postDelete(ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONTENT, new ContentEvent($this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user