Fixed getUrl()

This commit is contained in:
franck
2013-08-31 15:52:42 +02:00
parent 533f18bcec
commit 6d5d0f6606
17 changed files with 214 additions and 131 deletions

View File

@@ -59,6 +59,8 @@ class Config extends BaseConfig {
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new ConfigEvent($this));
return true;
}
public function postDelete(ConnectionInterface $con = null)

View File

@@ -102,38 +102,6 @@ class Customer extends BaseCustomer implements UserInterface
}
}
public function preInsert(ConnectionInterface $con = null)
{
$this->setRef($this->generateRef());
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, $customerEvent);
return true;
}
public function postInsert(ConnectionInterface $con = null)
{
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, $customerEvent);
}
public function preUpdate(ConnectionInterface $con = null)
{
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, $customerEvent);
return true;
}
public function postUpdate(ConnectionInterface $con = null)
{
$customerEvent = new CustomerEvent($this);
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, $customerEvent);
}
protected function generateRef()
{
return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
@@ -202,4 +170,57 @@ class Customer extends BaseCustomer implements UserInterface
public function getRoles() {
return array(new Role('CUSTOMER'));
}
/**
* {@inheritDoc}
*/
public function preInsert(ConnectionInterface $con = null)
{
$this->setRef($this->generateRef());
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECUSTOMER, new CustomerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CREATECUSTOMER, new CustomerEvent($this));
}
/**
* {@inheritDoc}
*/
public function preUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_CHANGECUSTOMER, new CustomerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postUpdate(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_CHANGECUSTOMER, new CustomerEvent($this));
}
/**
* {@inheritDoc}
*/
public function preDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::BEFORE_DELETECONFIG, new CustomerEvent($this));
return true;
}
/**
* {@inheritDoc}
*/
public function postDelete(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::AFTER_DELETECONFIG, new CustomerEvent($this));
}
}

View File

@@ -40,6 +40,8 @@ trait ModelEventDispatcherTrait {
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
return $this;
}
protected function dispatchEvent($eventName, ActionEvent $event)