Merge branch 'master' of https://github.com/thelia/thelia into coupon
# By Etienne Roudeix # Via Etienne Roudeix (2) and gmorel (2) * 'master' of https://github.com/thelia/thelia: pass container to thelialoop smarty plugin then to baseloop
This commit is contained in:
@@ -149,11 +149,7 @@
|
||||
|
||||
<service id="smarty.plugin.thelialoop" class="Thelia\Core\Template\Smarty\Plugins\TheliaLoop" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
<argument type="service" id="thelia.securityContext"/>
|
||||
|
||||
<argument type="service" id="service_container" />
|
||||
<call method="setLoopList">
|
||||
<argument>%thelia.parser.loops%</argument>
|
||||
</call>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Template\Element;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
@@ -52,6 +53,9 @@ abstract class BaseLoop
|
||||
*/
|
||||
protected $securityContext;
|
||||
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
protected $args;
|
||||
|
||||
public $countable = true;
|
||||
@@ -61,15 +65,15 @@ abstract class BaseLoop
|
||||
/**
|
||||
* Create a new Loop
|
||||
*
|
||||
* @param Request $request
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @param SecurityContext $securityContext
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function __construct(Request $request, EventDispatcherInterface $dispatcher, SecurityContext $securityContext)
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->securityContext = $securityContext;
|
||||
$this->container = $container;
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
@@ -44,14 +45,22 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
protected $dispatcher;
|
||||
protected $securityContext;
|
||||
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
protected $loopstack = 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->dispatcher = $dispatcher;
|
||||
$this->securityContext = $securityContext;
|
||||
$this->container = $container;
|
||||
|
||||
$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(
|
||||
$this->request,
|
||||
$this->dispatcher,
|
||||
$this->securityContext
|
||||
$this->container
|
||||
);
|
||||
|
||||
$loop->initializeArgs($smartyParams);
|
||||
|
||||
@@ -71,4 +71,9 @@ class Cart extends BaseCart
|
||||
->findOne()
|
||||
;
|
||||
}
|
||||
|
||||
public function getTaxedAmount()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user