8000 [WIP] Kernel refactor by fabpot · Pull Request #6459 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide 8000 file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
moved the deprecation logic calls outside the new HttpContentRenderer…
… class
  • Loading branch information
fabpot committed Jan 10, 2013
commit 2eea7682e76e03aeb08064cba1c8a70c29f7ba0d
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
5E0A
Original file line number Diff line number Diff line change
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
0