Merge branch 'optim' of https://github.com/thelia/thelia into optim

Conflicts:
	core/lib/Thelia/Action/Order.php
	core/lib/Thelia/Core/Template/Element/BaseLoop.php
This commit is contained in:
Franck Allimant
2014-01-31 15:49:59 +01:00
353 changed files with 5389 additions and 3089 deletions

View File

@@ -36,7 +36,7 @@ use Thelia\Model\Map\AddressTableMap;
* @package Thelia\Action
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class Address extends BaseAction implements EventSubscriberInterface
class Address implements EventSubscriberInterface
{
public function create(AddressCreateOrUpdateEvent $event)
@@ -69,7 +69,7 @@ class Address extends BaseAction implements EventSubscriberInterface
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
{
$addressModel->setDispatcher($this->getDispatcher());
$addressModel->setDispatcher($event->getDispatcher());
$con = Propel::getWriteConnection(AddressTableMap::DATABASE_NAME);
$con->beginTransaction();
try {

View File

@@ -30,7 +30,7 @@ use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Admin as AdminModel;
use Thelia\Model\AdminQuery;
class Administrator extends BaseAction implements EventSubscriberInterface
class Administrator implements EventSubscriberInterface
{
/**
* @param AdministratorEvent $event
@@ -40,12 +40,13 @@ class Administrator extends BaseAction implements EventSubscriberInterface
$administrator = new AdminModel();
$administrator
->setDispatcher($this->getDispatcher())
->setDispatcher($event->getDispatcher())
->setFirstname($event->getFirstname())
->setLastname($event->getLastname())
->setLogin($event->getLogin())
->setPassword($event->getPassword())
->setProfileId($event->getProfile())
->setLocale($event->getLocale())
;
$administrator->save();
@@ -61,11 +62,12 @@ class Administrator extends BaseAction implements EventSubscriberInterface
if (null !== $administrator = AdminQuery::create()->findPk($event->getId())) {
$administrator
->setDispatcher($this->getDispatcher())
->setDispatcher($event->getDispatcher())
->setFirstname($event->getFirstname())
->setLastname($event->getLastname())
->setLogin($event->getLogin())
->setProfileId($event->getProfile())
->setLocale($event->getLocale())
;
if ('' !== $event->getPassword()) {

View File

@@ -23,15 +23,12 @@
namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Config as ConfigModel;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\Config\ConfigUpdateEvent;
use Thelia\Core\Event\Config\ConfigCreateEvent;
use Thelia\Core\Event\Config\ConfigDeleteEvent;
use Thelia\Core\Event\Config\ConfigUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Config as ConfigModel;
use Thelia\Model\ConfigQuery;
class Config extends BaseAction implements EventSubscriberInterface
{
@@ -44,9 +41,14 @@ class Config extends BaseAction implements EventSubscriberInterface
{
$config = new ConfigModel();
$config->setDispatcher($this->getDispatcher())->setName($event->getEventName())->setValue($event->getValue())
->setLocale($event->getLocale())->setTitle($event->getTitle())->setHidden($event->getHidden())
->setSecured($event->getSecured())->save();
$config->setDispatcher($this->getDispatcher())
->setName($event->getEventName())
->setValue($event->getValue())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setHidden($event->getHidden())
->setSecured($event->getSecured())
->save();
$event->setConfig($config);
}
@@ -59,7 +61,7 @@ class Config extends BaseAction implements EventSubscriberInterface
public function setValue(ConfigUpdateEvent $event)
{
if (null !== $config = $search->findPk($event->getConfigId())) {
if (null !== $config = ConfigQuery::create()->findPk($event->getConfigId())) {
if ($event->getValue() !== $config->getValue()) {
@@ -80,10 +82,17 @@ class Config extends BaseAction implements EventSubscriberInterface
if (null !== $config = ConfigQuery::create()->findPk($event->getConfigId())) {
$config->setDispatcher($this->getDispatcher())->setName($event->getEventName())->setValue($event->getValue())
->setHidden($event->getHidden())->setSecured($event->getSecured())->setLocale($event->getLocale())
->setTitle($event->getTitle())->setDescription($event->getDescription())->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())->save();
$config->setDispatcher($this->getDispatcher())
->setName($event->getEventName())
->setValue($event->getValue())
->setHidden($event->getHidden())
->setSecured($event->getSecured())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
->setChapo($event->getChapo())
->setPostscriptum($event->getPostscriptum())
->save();
$event->setConfig($config);
}

View File

@@ -28,6 +28,7 @@ use Thelia\Core\Event\ActionEvent;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Security\SecurityContext;
use Thelia\Model\Customer as CustomerModel;
use Thelia\Core\Event\Customer\CustomerLoginEvent;
@@ -39,8 +40,14 @@ use Thelia\Core\Event\Customer\CustomerLoginEvent;
* @package Thelia\Action
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class Customer extends BaseAction implements EventSubscriberInterface
class Customer implements EventSubscriberInterface
{
protected $securityContext;
public function __construct(SecurityContext $securityContext)
{
$this->securityContext = $securityContext;
}
public function create(CustomerCreateOrUpdateEvent $event)
{
@@ -65,7 +72,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
$customer = $event->getCustomer();
$customer->setDispatcher($this->getDispatcher());
$customer->setDispatcher($event->getDispatcher());
$customer
->setTitleId($event->getTitle())
@@ -91,7 +98,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
private function createOrUpdateCustomer(CustomerModel $customer, CustomerCreateOrUpdateEvent $event)
{
$customer->setDispatcher($this->getDispatcher());
$customer->setDispatcher($event->getDispatcher());
$customer->createOrUpdate(
$event->getTitle(),
@@ -140,7 +147,7 @@ class Customer extends BaseAction implements EventSubscriberInterface
*/
protected function getSecurityContext()
{
return $this->container->get('thelia.securityContext');
return $this->securityContext;
}
/**

View File

@@ -23,33 +23,30 @@
namespace Thelia\Action;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Cart\CartTrait;
use Thelia\Core\Event\Cart\CartEvent;
use Thelia\Core\Event\Order\OrderAddressEvent;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\Order\OrderManualEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Exception\TheliaProcessException;
use Thelia\Model\AddressQuery;
use Thelia\Model\Cart as CartModel;
use Thelia\Model\ConfigQuery;
use Thelia\Model\MessageQuery;
use Thelia\Model\OrderProductAttributeCombination;
use Thelia\Model\ModuleQuery;
use Thelia\Model\OrderProduct;
use Thelia\Model\OrderStatus;
use Thelia\Model\Currency;
use Thelia\Model\Customer;
use Thelia\Model\Lang;
use Thelia\Model\Map\OrderTableMap;
use Thelia\Model\MessageQuery;
use Thelia\Model\ModuleQuery;
use Thelia\Model\Order as ModelOrder;
use Thelia\Model\OrderAddress;
use Thelia\Model\OrderProduct;
use Thelia\Model\OrderProductAttributeCombination;
use Thelia\Model\OrderStatus;
use Thelia\Model\OrderStatusQuery;
use Thelia\Tools\I18n;
use Thelia\Model\Currency;
use Thelia\Model\Lang;
use Thelia\Model\Country;
use Thelia\Model\Customer;
use Thelia\Core\Event\Order\OrderManualEvent;
use Thelia\Model\Cart as CartModel;
use Thelia\Model\Order as ModelOrder;
/**
*
@@ -129,7 +126,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$con->beginTransaction();
/* use a copy to avoid errored reccord in session */
/* use a copy to avoid errored record in session */
$placedOrder = $sessionOrder->copy();
$placedOrder->setDispatcher($this->getDispatcher());
@@ -307,9 +304,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$this->getSecurityContext()->getCustomerUser()
);
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
$event->getDispatcher()->dispatch(TheliaEvents::ORDER_BEFORE_PAYMENT, new OrderEvent($placedOrder));
/* clear session */
$session
@@ -322,7 +317,7 @@ class Order extends BaseAction implements EventSubscriberInterface
$event->setPlacedOrder($placedOrder);
/* empty cart */
$this->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
$event->getDispatcher()->dispatch(TheliaEvents::CART_CLEAR, new CartEvent($this->getCart($this->getRequest())));
/* call pay method */