diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php index 39e18a6ab..b7522d104 100644 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/XmlFileLoader.php @@ -53,8 +53,6 @@ class XmlFileLoader extends FileLoader $this->container->addResource(new FileResource($path)); - $this->parseDefinitions($xml, $path); - $this->parseLoops($xml); $this->parseFilters($xml); @@ -62,8 +60,32 @@ class XmlFileLoader extends FileLoader $this->parseBaseParams($xml); $this->parseTestLoops($xml); + + $this->parseParameters($xml); + + $this->parseDefinitions($xml, $path); } + /** + * Parses parameters + * + * @param SimpleXMLElement $xml + */ + protected function parseParameters(SimpleXMLElement $xml) + { + if (!$xml->parameters) { + return; + } + + $this->container->getParameterBag()->add($xml->parameters->getArgumentsAsPhp('parameter')); + } + + /** + * + * parse Loops property + * + * @param SimpleXMLElement $xml + */ protected function parseLoops(SimpleXMLElement $xml) { if (false === $loops = $xml->xpath('//config:loops/config:loop')) { @@ -82,6 +104,11 @@ class XmlFileLoader extends FileLoader $this->container->setParameter("Tpex.loop", $loopConfig); } + /** + * parse Filters property + * + * @param SimpleXMLElement $xml + */ protected function parseFilters(SimpleXMLElement $xml) { if (false === $filters = $xml->xpath('//config:filters/config:filter')) { @@ -100,6 +127,11 @@ class XmlFileLoader extends FileLoader $this->container->setParameter("Tpex.filter", $filterConfig); } + /** + * parse BaseParams property + * + * @param SimpleXMLElement $xml + */ protected function parseBaseParams(SimpleXMLElement $xml) { if (false === $baseParams = $xml->xpath('//config:baseParams/config:baseParam')) { @@ -118,6 +150,11 @@ class XmlFileLoader extends FileLoader $this->container->setParameter("Tpex.baseParam", $baseParamConfig); } + /** + * parse testLoops property + * + * @param SimpleXMLElement $xml + */ protected function parseTestLoops(SimpleXMLElement $xml) { if (false === $testLoops = $xml->xpath('//config:testLoops/config:testLoop')) { diff --git a/core/lib/Thelia/Core/DependencyInjection/Loader/schema/dic/config/thelia-1.0.xsd b/core/lib/Thelia/Core/DependencyInjection/Loader/schema/dic/config/thelia-1.0.xsd index 64563b0cb..430a82362 100644 --- a/core/lib/Thelia/Core/DependencyInjection/Loader/schema/dic/config/thelia-1.0.xsd +++ b/core/lib/Thelia/Core/DependencyInjection/Loader/schema/dic/config/thelia-1.0.xsd @@ -14,9 +14,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/lib/Thelia/Routing/Matcher/ActionMatcher.php b/core/lib/Thelia/Routing/Matcher/ActionMatcher.php index 97ba7af59..d4dd7eb37 100644 --- a/core/lib/Thelia/Routing/Matcher/ActionMatcher.php +++ b/core/lib/Thelia/Routing/Matcher/ActionMatcher.php @@ -64,7 +64,13 @@ class ActionMatcher implements RequestMatcherInterface protected function dispatchAction(Request $request, $action) { $controller = null; - switch ($action) { + $event = new ActionEvent($request, $action); + $this->dispatcher->dispatch(TheliaEvents::ACTION, $event); + if ($event->hasController()) { + $controller = $event->getController(); + } + +/* switch ($action) { case 'addProduct': $controller = array( new Cart($this->dispatcher), @@ -78,7 +84,7 @@ class ActionMatcher implements RequestMatcherInterface $controller = $event->getController(); } break; - } + }*/ if ($controller) { return array( diff --git a/core/lib/Thelia/Tpex b/core/lib/Thelia/Tpex index a674fe8c6..615448ebe 160000 --- a/core/lib/Thelia/Tpex +++ b/core/lib/Thelia/Tpex @@ -1 +1 @@ -Subproject commit a674fe8c61f2cef2db71e9bf85e3ab9b2c377bec +Subproject commit 615448ebe09e037142a0604eaf00a36048e9eed5