moved the deprecation logic calls outside the new HttpContentRenderer class
This commit is contained in:
parent
bd102c5eba
commit
2eea7682e7
|
@ -54,6 +54,8 @@ class HttpKernelExtension extends \Twig_Extension
|
|||
*/
|
||||
public function render($uri, $options = array())
|
||||
{
|
||||
$options = $this->renderer->fixOptions($options);
|
||||
|
||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
|
||||
unset($options['strategy']);
|
||||
|
||||
|
|
|
@ -105,6 +105,8 @@ class HttpKernel extends BaseHttpKernel
|
|||
{
|
||||
trigger_error('render() is deprecated since version 2.2 and will be removed in 2.3. Use Symfony\Component\HttpKernel\HttpContentRenderer::render() instead.', E_USER_DEPRECATED);
|
||||
|
||||
$options = $this->renderer->fixOptions($options);
|
||||
|
||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
|
||||
unset($options['strategy']);
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ class ActionsHelper extends Helper
|
|||
*/
|
||||
public function render($uri, array $options = array())
|
||||
{
|
||||
$options = $this->renderer->fixOptions($options);
|
||||
|
||||
$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
|
||||
unset($options['strategy']);
|
||||
|
||||
|
|
|
@ -97,11 +97,6 @@ class HttpContentRenderer implements EventSubscriberInterface
|
|||
$options['ignore_errors'] = !$this->debug;
|
||||
}
|
||||
|
||||
$options = $this->fixOptions($options);
|
||||
if (isset($options['strategy'])) {
|
||||
$strategy = $options['strategy'];
|
||||
}
|
||||
|
||||
if (!isset($this->strategies[$strategy])) {
|
||||
throw new \InvalidArgumentException(sprintf('The "%s" rendering strategy does not exist.', $strategy));
|
||||
}
|
||||
|
@ -118,7 +113,7 @@ class HttpContentRenderer implements EventSubscriberInterface
|
|||
}
|
||||
|
||||
// to be removed in 2.3
|
||||
private function fixOptions($options)
|
||||
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'])) {
|
||||
|
@ -136,6 +131,7 @@ class HttpContentRenderer implements EventSubscriberInterface
|
|||
}
|
||||
|
||||
$options['strategy'] = $options['standalone'];
|
||||
unset($options['standalone']);
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
|
Reference in New Issue