Skip to content

Commit

Permalink
moved the deprecation logic calls outside the new HttpContentRenderer…
Browse files Browse the repository at this point in the history
… class
  • Loading branch information
fabpot committed Jan 10, 2013
1 parent bd102c5 commit 2eea768
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
Expand Up @@ -54,6 +54,8 @@ public function getFunctions()
*/
public function render($uri, $options = array())
{
$options = $this->renderer->fixOptions($options);

$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
unset($options['strategy']);

Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/HttpKernel.php
Expand Up @@ -105,6 +105,8 @@ 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\HttpContentRenderer::render() instead.', E_USER_DEPRECATED);

$options = $this->renderer->fixOptions($options);

$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
unset($options['strategy']);

Expand Down
Expand Up @@ -46,6 +46,8 @@ public function __construct(HttpContentRenderer $renderer)
*/
public function render($uri, array $options = array())
{
$options = $this->renderer->fixOptions($options);

$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
unset($options['strategy']);

Expand Down
8 changes: 2 additions & 6 deletions src/Symfony/Component/HttpKernel/HttpContentRenderer.php
Expand Up @@ -97,11 +97,6 @@ public function render($uri, $strategy = 'default', array $options = array())
$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));
}
Expand All @@ -118,7 +113,7 @@ public static function getSubscribedEvents()
}

// 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'])) {
Expand All @@ -136,6 +131,7 @@ private function fixOptions($options)
}

$options['strategy'] = $options['standalone'];
unset($options['standalone']);
}

return $options;
Expand Down

1 comment on commit 2eea768

@lsmith77
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the renderer property supposed to be populated?

Please sign in to comment.