Browse files

removed deprecated stuff in the fragment sub-framework

  • Loading branch information...
1 parent 0a06a7c commit 5ff6006fa6689291e9ccec1d375b7c88e504e5a8 @fabpot fabpot committed Mar 1, 2013
View
2 src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
@@ -54,8 +54,6 @@ public function getFunctions()
*/
public function renderFragment($uri, $options = array())
{
- $options = $this->handler->fixOptions($options);
-
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
unset($options['strategy']);
View
83 src/Symfony/Bundle/FrameworkBundle/HttpKernel.php
@@ -1,83 +0,0 @@
-<?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;
-
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\HttpKernelInterface;
-use Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel;
-
-/**
- * This HttpKernel is used to manage scope changes of the DI container.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Johannes M. Schmitt <schmittjoh@gmail.com>
- *
- * @deprecated This class is deprecated in 2.2 and will be removed in 2.3
- */
-class HttpKernel extends ContainerAwareHttpKernel
-{
- /**
- * Forwards the request to another controller.
- *
- * @param string $controller The controller name (a string like BlogBundle:Post:index)
- * @param array $attributes An array of request attributes
- * @param array $query An array of request query parameters
- *
- * @return Response A Response instance
- *
- * @deprecated in 2.2, will be removed in 2.3
- */
- public function forward($controller, array $attributes = array(), array $query = array())
- {
- trigger_error('forward() is deprecated since version 2.2 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- $attributes['_controller'] = $controller;
- $subRequest = $this->container->get('request')->duplicate($query, null, $attributes);
-
- return $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
- }
-
- /**
- * Renders a Controller and returns the Response content.
- *
- * Note that this method generates an esi:include tag only when both the standalone
- * option is set to true and the request has ESI capability (@see Symfony\Component\HttpKernel\HttpCache\ESI).
- *
- * Available options:
- *
- * * ignore_errors: true to return an empty string in case of an error
- * * alt: an alternative URI to execute in case of an error
- * * standalone: whether to generate an esi:include tag or not when ESI is supported
- * * comment: a comment to add when returning an esi:include tag
- *
- * @param string $uri A URI
- * @param array $options An array of options
- *
- * @return string The Response content
- *
- * @throws \RuntimeException
- * @throws \Exception
- *
- * @deprecated in 2.2, will be removed in 2.3 (use Symfony\Component\HttpKernel\Fragment\FragmentHandler::render() instead)
- */
- public function render($uri, array $options = array())
- {
- trigger_error('render() is deprecated since version 2.2 and will be removed in 2.3. Use Symfony\Component\HttpKernel\Fragment\FragmentHandler::render() instead.', E_USER_DEPRECATED);
-
- $options = $this->renderer->fixOptions($options);
-
- $strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
- unset($options['strategy']);
-
- $this->container->get('fragment.handler')->render($uri, $strategy, $options);
- }
-}
View
2 src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php
@@ -46,8 +46,6 @@ public function __construct(FragmentHandler $handler)
*/
public function render($uri, array $options = array())
{
- $options = $this->handler->fixOptions($options);
-
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
unset($options['strategy']);
View
29 src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php
@@ -143,33 +143,4 @@ public static function getSubscribedEvents()
KernelEvents::RESPONSE => 'onKernelResponse',
);
}
-
- // to be removed in 2.3
- public function fixOptions(array $options)
- {
- // support for the standalone option is @deprecated in 2.2 and replaced with the strategy option
- if (isset($options['standalone'])) {
- trigger_error('The "standalone" option is deprecated in version 2.2 and replaced with the "strategy" option.', E_USER_DEPRECATED);
-
- // support for the true value is @deprecated in 2.2, will be removed in 2.3
- if (true === $options['standalone']) {
- trigger_error('The "true" value for the "standalone" option is deprecated in version 2.2 and replaced with the "esi" value.', E_USER_DEPRECATED);
-
- $options['standalone'] = 'esi';
- } elseif (false === $options['standalone']) {
- trigger_error('The "false" value for the "standalone" option is deprecated in version 2.2 and replaced with the "inline" value.', E_USER_DEPRECATED);
-
- $options['standalone'] = 'inline';
- } elseif ('js' === $options['standalone']) {
- trigger_error('The "js" value for the "standalone" option is deprecated in version 2.2 and replaced with the "hinclude" value.', E_USER_DEPRECATED);
-
- $options['standalone'] = 'hinclude';
- }
-
- $options['strategy'] = $options['standalone'];
- unset($options['standalone']);
- }
-
- return $options;
- }
}
View
21 src/Symfony/Component/HttpKernel/Tests/Fragment/FragmentHandlerTest.php
@@ -61,27 +61,6 @@ public function testRender()
$this->assertEquals('foo', $handler->render('/', 'foo', array('foo' => 'foo')));
}
- /**
- * @dataProvider getFixOptionsData
- */
- public function testFixOptions($expected, $options)
- {
- $handler = new FragmentHandler();
-
- set_error_handler(function ($errorNumber, $message, $file, $line, $context) { return $errorNumber & E_USER_DEPRECATED; });
- $this->assertEquals($expected, $handler->fixOptions($options));
- restore_error_handler();
- }
-
- public function getFixOptionsData()
- {
- return array(
- array(array('strategy' => 'esi'), array('standalone' => true)),
- array(array('strategy' => 'esi'), array('standalone' => 'esi')),
- array(array('strategy' => 'hinclude'), array('standalone' => 'js')),
- );
- }
-
protected function getHandler($returnValue, $arguments = array())
{
$renderer = $this->getMock('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface');

0 comments on commit 5ff6006

Please sign in to comment.