|
@@ -3,10 +3,8 @@
|
|
|
namespace Symfony\Framework\WebBundle\Helper;
|
|
|
|
|
|
use Symfony\Components\Templating\Helper\Helper;
|
|
|
-use Symfony\Components\DependencyInjection\ContainerInterface;
|
|
|
use Symfony\Components\OutputEscaper\Escaper;
|
|
|
-use Symfony\Components\HttpKernel\HttpKernelInterface;
|
|
|
-use Symfony\Components\HttpKernel\Request;
|
|
|
+use Symfony\Framework\WebBundle\Controller\ControllerManager;
|
|
|
|
|
|
/*
|
|
|
* This file is part of the Symfony framework.
|
|
@@ -26,16 +24,16 @@ use Symfony\Components\HttpKernel\Request;
|
|
|
*/
|
|
|
class ActionsHelper extends Helper
|
|
|
{
|
|
|
- protected $container;
|
|
|
+ protected $manager;
|
|
|
|
|
|
/**
|
|
|
* Constructor.
|
|
|
*
|
|
|
* @param Constructor $container A ContainerInterface instance
|
|
|
*/
|
|
|
- public function __construct(ContainerInterface $container)
|
|
|
+ public function __construct(ControllerManager $manager)
|
|
|
{
|
|
|
- $this->container = $container;
|
|
|
+ $this->manager = $manager;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -54,33 +52,24 @@ class ActionsHelper extends Helper
|
|
|
/**
|
|
|
* Returns the Response content for a given controller or URI.
|
|
|
*
|
|
|
- * Available options:
|
|
|
- *
|
|
|
- * * path: An array of path parameters (only when the first argument is a controller)
|
|
|
- * * query: An array of query parameters (only when the first argument is a controller)
|
|
|
- * * ignore_errors: true to return an empty string in case of an error
|
|
|
- * * alt: an alternative controller to execute in case of an error (can be a controller, a URI, or an array with the controller, the path arguments, and the query arguments)
|
|
|
- *
|
|
|
* @param string $controller A controller name to execute (a string like BlogBundle:Post:index), or a relative URI
|
|
|
* @param array $options An array of options
|
|
|
+ *
|
|
|
+ * @see Symfony\Framework\WebBundle\Controller\ControllerManager::render()
|
|
|
*/
|
|
|
public function render($controller, array $options = array())
|
|
|
{
|
|
|
- $options = array_merge(array(
|
|
|
- 'path' => array(),
|
|
|
- 'query' => array(),
|
|
|
- 'ignore_errors' => true,
|
|
|
- 'alt' => array(),
|
|
|
- ), $options);
|
|
|
-
|
|
|
- if (!is_array($options['alt'])) {
|
|
|
- $options['alt'] = array($options['alt']);
|
|
|
+ if (isset($options['path']))
|
|
|
+ {
|
|
|
+ $options['path'] = Escaper::unescape($options['path']);
|
|
|
}
|
|
|
|
|
|
- $options['path'] = Escaper::unescape($options['path']);
|
|
|
- $options['query'] = Escaper::unescape($options['query']);
|
|
|
+ if (isset($options['query']))
|
|
|
+ {
|
|
|
+ $options['query'] = Escaper::unescape($options['query']);
|
|
|
+ }
|
|
|
|
|
|
- return $this->container->getControllerManagerService()->render($controller, $options);
|
|
|
+ return $this->manager->render($controller, $options);
|
|
|
}
|
|
|
|
|
|
/**
|