merge Tpex DI branch and add paramters to config
This commit is contained in:
@@ -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')) {
|
||||
|
||||
@@ -14,9 +14,45 @@
|
||||
<xsd:element name="baseParams" type="baseParams" />
|
||||
<xsd:element name="testLoops" type="testLoops" />
|
||||
<xsd:element name="services" type="services" />
|
||||
<xsd:element name="parameters" type="parameters"/>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="parameters">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="parameter" type="parameter" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="type" type="parameter_type" />
|
||||
<xsd:attribute name="key" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="parameter" mixed="true">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="parameter" type="parameter" />
|
||||
</xsd:choice>
|
||||
<xsd:attribute name="type" type="parameter_type" />
|
||||
<xsd:attribute name="id" type="xsd:string" />
|
||||
<xsd:attribute name="key" type="xsd:string" />
|
||||
<xsd:attribute name="on-invalid" type="invalid_sequence" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:simpleType name="parameter_type">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="collection" />
|
||||
<xsd:enumeration value="service" />
|
||||
<xsd:enumeration value="string" />
|
||||
<xsd:enumeration value="constant" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:simpleType name="invalid_sequence">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="null" />
|
||||
<xsd:enumeration value="ignore" />
|
||||
<xsd:enumeration value="exception" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
|
||||
<xsd:complexType name="loops">
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded" >
|
||||
<xsd:element name="loop" type="loop"/>
|
||||
|
||||
@@ -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(
|
||||
|
||||
Submodule core/lib/Thelia/Tpex updated: a674fe8c61...615448ebe0
Reference in New Issue
Block a user