update api documentation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Thelia\Core\Event\Internal\CustomerEvent;
|
||||
use Thelia\Model\Base\Customer as BaseCustomer;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
@@ -105,16 +106,43 @@ class Customer extends BaseCustomer implements UserInterface
|
||||
|
||||
public function preInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
$customerRef = new CustomRefEvent($this);
|
||||
if (!is_null($this->dispatcher)) {
|
||||
$this->dispatcher->dispatch(TheliaEvents::CREATECUSTOMER_CUSTOMREF, $customerRef);
|
||||
}
|
||||
$this->setRef($this->generateRef());
|
||||
$customerEvent = new CustomerEvent($this);
|
||||
|
||||
$this->setRef($customerRef->hasRef()? $customerRef->getRef() : $this->generateRef());
|
||||
$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 dispatchEvent($eventName, CustomerEvent $customerEvent)
|
||||
{
|
||||
if (!is_null($this->dispatcher)) {
|
||||
$this->dispatcher->dispatch($eventName, $customerEvent);
|
||||
}
|
||||
}
|
||||
|
||||
protected function generateRef()
|
||||
{
|
||||
return uniqid(substr($this->getLastname(), 0, (strlen($this->getLastname()) >= 3) ? 3 : strlen($this->getLastname())), true);
|
||||
|
||||
Reference in New Issue
Block a user