diff --git a/composer.lock b/composer.lock index 03f55c3bd..081028c9f 100644 --- a/composer.lock +++ b/composer.lock @@ -76,7 +76,7 @@ "authors": [ { "name": "Anthony Ferrara", - "email": "ircmaxell@ircmaxell.com", + "email": "ircmaxell@php.net", "homepage": "http://blog.ircmaxell.com" } ], @@ -772,12 +772,12 @@ "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "c2b06f9741106c35eb7e21dda4c72a54415277dd" + "reference": "202c8517478011464e0e50923cab2bcd6344453b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/c2b06f9741106c35eb7e21dda4c72a54415277dd", - "reference": "c2b06f9741106c35eb7e21dda4c72a54415277dd", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/202c8517478011464e0e50923cab2bcd6344453b", + "reference": "202c8517478011464e0e50923cab2bcd6344453b", "shasum": "" }, "require": { @@ -791,7 +791,8 @@ }, "autoload": { "psr-0": { - "Faker": "src/" + "Faker": "src/", + "Faker\\PHPUnit": "test/" } }, "notification-url": "https://packagist.org/downloads/", @@ -809,7 +810,7 @@ "faker", "fixtures" ], - "time": "2013-05-13 07:57:43" + "time": "2013-05-20 20:34:10" } ], "aliases": [ diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index fa309cd2b..2f5583e94 100644 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -4,6 +4,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd"> + + + Thelia\Core\Event\CartEvent + Thelia\Core\Event\CartEvent + Thelia\Core\Event\CartEvent + + diff --git a/core/lib/Thelia/Core/EventListener/ControllerListener.php b/core/lib/Thelia/Core/EventListener/ControllerListener.php index f30631e03..6582797fb 100644 --- a/core/lib/Thelia/Core/EventListener/ControllerListener.php +++ b/core/lib/Thelia/Core/EventListener/ControllerListener.php @@ -48,7 +48,7 @@ class ControllerListener implements EventSubscriberInterface $request = $event->getRequest(); if (false !== $action = $request->get("action")) { //search corresponding action - $event = new ActionEventFactory($request, $action, $event->getDispatcher()); + $event = new ActionEventFactory($request, $action, $event->getDispatcher(), $event->getKernel()->getContainer()->getParameter("thelia.actionEvent")); $dispatcher->dispatch("action.".$action, $event->createActionEvent()); } diff --git a/core/lib/Thelia/Core/Factory/ActionEventFactory.php b/core/lib/Thelia/Core/Factory/ActionEventFactory.php index e2ac7d016..0cb26ce4e 100644 --- a/core/lib/Thelia/Core/Factory/ActionEventFactory.php +++ b/core/lib/Thelia/Core/Factory/ActionEventFactory.php @@ -39,19 +39,16 @@ class ActionEventFactory * * @var array */ - protected $className = array( - "addArticle" => "Thelia\Core\Event\CartEvent", - "deleteArticle" => "Thelia\Core\Event\CartEvent", - "modifyArticle" => "Thelia\Core\Event\CartEvent", - ); + protected $className; protected $defaultClassName = "Thelia\Core\Event\DefaultActionEvent"; - public function __construct(Request $request, $action, EventDispatcherInterface $dispatcher) + public function __construct(Request $request, $action, EventDispatcherInterface $dispatcher, $className) { $this->request = $request; $this->action = $action; $this->dispatcher = $dispatcher; + $this->className = $className; } public function createActionEvent() diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index 57ff21e54..c19b2b258 100644 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -39,6 +39,9 @@ use Thelia\Model; class TheliaHttpKernel extends HttpKernel { + + protected $container; + public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver) { parent::__construct($dispatcher, $controllerResolver); @@ -46,6 +49,11 @@ class TheliaHttpKernel extends HttpKernel $this->container = $container; } + public function getContainer() + { + return $this->container; + } + /** * Handles a Request to convert it to a Response. *