fixed a circular reference (closes #6730)

This commit is contained in:
Fabien Potencier 2013-01-23 14:48:08 +01:00
parent 4bdfb92a35
commit 65b4112ddb
3 changed files with 53 additions and 3 deletions

View File

@ -0,0 +1,49 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\RenderingStrategy;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\UriSigner;
use Symfony\Component\HttpKernel\RenderingStrategy\HIncludeRenderingStrategy;
/**
* Implements the Hinclude rendering strategy.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ContainerAwareHIncludeRenderingStrategy extends HIncludeRenderingStrategy
{
private $container;
/**
* {@inheritdoc}
*/
public function __construct(ContainerInterface $container, UriSigner $signer = null, $globalDefaultTemplate = null)
{
$this->container = $container;
parent::__construct(null, $signer, $globalDefaultTemplate);
}
/**
* {@inheritdoc}
*/
public function render($uri, Request $request, array $options = array())
{
if (!$this->templating) {
$this->templating = $this->container->get('templating');
}
return parent::render($uri, $request, $options);
}
}

View File

@ -7,7 +7,7 @@
<parameters>
<parameter key="http_content_renderer.class">Symfony\Component\HttpKernel\HttpContentRenderer</parameter>
<parameter key="http_content_renderer.strategy.default.class">Symfony\Component\HttpKernel\RenderingStrategy\DefaultRenderingStrategy</parameter>
<parameter key="http_content_renderer.strategy.hinclude.class">Symfony\Component\HttpKernel\RenderingStrategy\HIncludeRenderingStrategy</parameter>
<parameter key="http_content_renderer.strategy.hinclude.class">Symfony\Bundle\FrameworkBundle\RenderingStrategy\ContainerAwareHIncludeRenderingStrategy</parameter>
<parameter key="http_content_renderer.strategy.hinclude.global_template"></parameter>
<parameter key="http_content_renderer.proxy_path">/_proxy</parameter>
</parameters>
@ -27,7 +27,7 @@
<service id="http_content_renderer.strategy.hinclude" class="%http_content_renderer.strategy.hinclude.class%">
<tag name="kernel.content_renderer_strategy" />
<argument type="service" id="templating" on-invalid="null" />
<argument type="service" id="service_container" />
<argument type="service" id="uri_signer" />
<argument>%http_content_renderer.strategy.hinclude.global_template%</argument>
<call method="setProxyPath"><argument>%http_content_renderer.proxy_path%</argument></call>

View File

@ -24,7 +24,8 @@ use Symfony\Component\HttpKernel\UriSigner;
*/
class HIncludeRenderingStrategy extends ProxyAwareRenderingStrategy
{
private $templating;
protected $templating;
private $globalDefaultTemplate;
private $signer;