[FrameworkBundle] removed obsolete ContainerAwareHIncludeFragmentRenderer class
This commit is contained in:
parent
e620cbfce2
commit
6148652d05
@ -539,6 +539,11 @@ class FrameworkExtension extends Extension
|
||||
$container->setAlias('templating', 'templating.engine.delegating');
|
||||
}
|
||||
|
||||
$container->getDefinition('fragment.renderer.hinclude')
|
||||
->addTag('kernel.fragment_renderer', array('alias' => 'hinclude'))
|
||||
->replaceArgument(0, new Reference('templating'))
|
||||
;
|
||||
|
||||
// configure the PHP engine if needed
|
||||
if (in_array('php', $config['engines'], true)) {
|
||||
$loader->load('templating_php.xml');
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Fragment;
|
||||
|
||||
trigger_error('The '.__NAMESPACE__.'\ContainerAwareHIncludeFragmentRenderer class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bundle\FrameworkBundle\Fragment\HIncludeFragmentRenderer instead.', E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
@ -20,6 +22,8 @@ use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
|
||||
* Implements the Hinclude rendering strategy.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @deprecated since version 2.7, to be removed in 3.0. Use Symfony\Bundle\FrameworkBundle\Fragment\HIncludeFragmentRenderer instead.
|
||||
*/
|
||||
class ContainerAwareHIncludeFragmentRenderer extends HIncludeFragmentRenderer
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parameters>
|
||||
<parameter key="fragment.handler.class">Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler</parameter>
|
||||
<parameter key="fragment.renderer.inline.class">Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer</parameter>
|
||||
<parameter key="fragment.renderer.hinclude.class">Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer</parameter>
|
||||
<parameter key="fragment.renderer.hinclude.class">Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer</parameter>
|
||||
<parameter key="fragment.renderer.hinclude.global_template"></parameter>
|
||||
<parameter key="fragment.renderer.esi.class">Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer</parameter>
|
||||
<parameter key="fragment.path">/_fragment</parameter>
|
||||
@ -28,8 +28,7 @@
|
||||
</service>
|
||||
|
||||
<service id="fragment.renderer.hinclude" class="%fragment.renderer.hinclude.class%">
|
||||
<tag name="kernel.fragment_renderer" alias="hinclude" />
|
||||
<argument type="service" id="service_container" />
|
||||
<argument /> <!-- templating or Twig service -->
|
||||
<argument type="service" id="uri_signer" />
|
||||
<argument>%fragment.renderer.hinclude.global_template%</argument>
|
||||
<call method="setFragmentPath"><argument>%fragment.path%</argument></call>
|
||||
|
@ -15,10 +15,12 @@ use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Fragment\ContainerAwareHIncludeFragmentRenderer;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ContainerAwareHIncludeFragmentRendererTest extends TestCase
|
||||
class LegacyContainerAwareHIncludeFragmentRendererTest extends TestCase
|
||||
{
|
||||
public function testRender()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
|
||||
$container->expects($this->once())
|
||||
->method('get')
|
@ -19,23 +19,7 @@ class FragmentController extends ContainerAware
|
||||
{
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
$actions = $this->container->get('templating')->get('actions');
|
||||
|
||||
$html1 = $actions->render($actions->controller('TestBundle:Fragment:inlined', array(
|
||||
'options' => array(
|
||||
'bar' => new Bar(),
|
||||
'eleven' => 11,
|
||||
),
|
||||
)));
|
||||
|
||||
$html2 = $actions->render($actions->controller('TestBundle:Fragment:customformat', array('_format' => 'html')));
|
||||
|
||||
$html3 = $actions->render($actions->controller('TestBundle:Fragment:customlocale', array('_locale' => 'es')));
|
||||
|
||||
$request->setLocale('fr');
|
||||
$html4 = $actions->render($actions->controller('TestBundle:Fragment:forwardlocale'));
|
||||
|
||||
return new Response($html1.'--'.$html2.'--'.$html3.'--'.$html4);
|
||||
return $this->container->get('templating')->renderResponse('fragment.html.php', array('bar' => new Bar()));
|
||||
}
|
||||
|
||||
public function inlinedAction($options, $_format)
|
||||
|
@ -0,0 +1,14 @@
|
||||
<?php echo $this->get('actions')->render($this->get('actions')->controller('TestBundle:Fragment:inlined', array(
|
||||
'options' => array(
|
||||
'bar' => $bar,
|
||||
'eleven' => 11,
|
||||
),
|
||||
)));
|
||||
?>--<?php
|
||||
echo $this->get('actions')->render($this->get('actions')->controller('TestBundle:Fragment:customformat', array('_format' => 'html')));
|
||||
?>--<?php
|
||||
echo $this->get('actions')->render($this->get('actions')->controller('TestBundle:Fragment:customlocale', array('_locale' => 'es')));
|
||||
?>--<?php
|
||||
$app->getRequest()->setLocale('fr');
|
||||
echo $this->get('actions')->render($this->get('actions')->controller('TestBundle:Fragment:forwardlocale'));
|
||||
?>
|
Reference in New Issue
Block a user