pass container to thelialoop smarty plugin then to baseloop
This commit is contained in:
@@ -146,11 +146,7 @@
|
|||||||
|
|
||||||
<service id="smarty.plugin.thelialoop" class="Thelia\Core\Template\Smarty\Plugins\TheliaLoop" scope="request">
|
<service id="smarty.plugin.thelialoop" class="Thelia\Core\Template\Smarty\Plugins\TheliaLoop" scope="request">
|
||||||
<tag name="thelia.parser.register_plugin"/>
|
<tag name="thelia.parser.register_plugin"/>
|
||||||
|
<argument type="service" id="service_container" />
|
||||||
<argument type="service" id="request" />
|
|
||||||
<argument type="service" id="event_dispatcher"/>
|
|
||||||
<argument type="service" id="thelia.securityContext"/>
|
|
||||||
|
|
||||||
<call method="setLoopList">
|
<call method="setLoopList">
|
||||||
<argument>%thelia.parser.loops%</argument>
|
<argument>%thelia.parser.loops%</argument>
|
||||||
</call>
|
</call>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Template\Element;
|
namespace Thelia\Core\Template\Element;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
@@ -52,6 +53,9 @@ abstract class BaseLoop
|
|||||||
*/
|
*/
|
||||||
protected $securityContext;
|
protected $securityContext;
|
||||||
|
|
||||||
|
/** @var ContainerInterface Service Container */
|
||||||
|
protected $container = null;
|
||||||
|
|
||||||
protected $args;
|
protected $args;
|
||||||
|
|
||||||
public $countable = true;
|
public $countable = true;
|
||||||
@@ -61,15 +65,15 @@ abstract class BaseLoop
|
|||||||
/**
|
/**
|
||||||
* Create a new Loop
|
* Create a new Loop
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param ContainerInterface $container
|
||||||
* @param EventDispatcherInterface $dispatcher
|
|
||||||
* @param SecurityContext $securityContext
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Request $request, EventDispatcherInterface $dispatcher, SecurityContext $securityContext)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->container = $container;
|
||||||
$this->dispatcher = $dispatcher;
|
|
||||||
$this->securityContext = $securityContext;
|
$this->request = $container->get('request');
|
||||||
|
$this->dispatcher = $container->get('event_dispatcher');
|
||||||
|
$this->securityContext = $container->get('thelia.securityContext');
|
||||||
|
|
||||||
$this->args = $this->getArgDefinitions()->addArguments($this->getDefaultArgs(), false);
|
$this->args = $this->getArgDefinitions()->addArguments($this->getDefaultArgs(), false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
@@ -44,14 +45,22 @@ class TheliaLoop extends AbstractSmartyPlugin
|
|||||||
protected $dispatcher;
|
protected $dispatcher;
|
||||||
protected $securityContext;
|
protected $securityContext;
|
||||||
|
|
||||||
|
/** @var ContainerInterface Service Container */
|
||||||
|
protected $container = null;
|
||||||
|
|
||||||
protected $loopstack = array();
|
protected $loopstack = array();
|
||||||
protected $varstack = array();
|
protected $varstack = array();
|
||||||
|
|
||||||
public function __construct(Request $request, EventDispatcherInterface $dispatcher, SecurityContext $securityContext)
|
/**
|
||||||
|
* @param ContainerInterface $container
|
||||||
|
*/
|
||||||
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->container = $container;
|
||||||
$this->dispatcher = $dispatcher;
|
|
||||||
$this->securityContext = $securityContext;
|
$this->request = $container->get('request');
|
||||||
|
$this->dispatcher = $container->get('event_dispatcher');
|
||||||
|
$this->securityContext = $container->get('thelia.securityContext');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -315,9 +324,7 @@ class TheliaLoop extends AbstractSmartyPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$loop = $class->newInstance(
|
$loop = $class->newInstance(
|
||||||
$this->request,
|
$this->container
|
||||||
$this->dispatcher,
|
|
||||||
$this->securityContext
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$loop->initializeArgs($smartyParams);
|
$loop->initializeArgs($smartyParams);
|
||||||
|
|||||||
@@ -71,4 +71,9 @@ class Cart extends BaseCart
|
|||||||
->findOne()
|
->findOne()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTaxedAmount()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user