Merge branch 'master' into loops

Conflicts:
	core/lib/Thelia/Core/Template/Loop/Category.php
	core/lib/Thelia/Core/Template/Loop/FeatureValue.php
	core/lib/Thelia/Core/Template/Loop/Folder.php
	core/lib/Thelia/Core/Template/Loop/Product.php
	core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
	install/faker.php
This commit is contained in:
Etienne Roudeix
2013-08-21 09:19:56 +02:00
3275 changed files with 929970 additions and 274940 deletions

38
documentation/api/files/Model/Customer.php.txt Normal file → Executable file
View File

@@ -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);