|
@@ -79,15 +79,15 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
* Forwards the request to another controller.
|
|
|
*
|
|
|
* @param string $controller The controller name (a string like BlogBundle:Post:index)
|
|
|
- * @param array $path An array of path parameters
|
|
|
- * @param array $query An array of query parameters
|
|
|
+ * @param array $attributes An array of request attributes
|
|
|
+ * @param array $query An array of request query parameters
|
|
|
*
|
|
|
* @return Response A Response instance
|
|
|
*/
|
|
|
- public function forward($controller, array $path = array(), array $query = array())
|
|
|
+ public function forward($controller, array $attributes = array(), array $query = array())
|
|
|
{
|
|
|
- $path['_controller'] = $controller;
|
|
|
- $subRequest = $this->container->getRequestService()->duplicate($query, null, $path);
|
|
|
+ $attributes['_controller'] = $controller;
|
|
|
+ $subRequest = $this->container->getRequestService()->duplicate($query, null, $attributes);
|
|
|
|
|
|
return $this->container->get('kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
|
|
|
}
|
|
@@ -100,10 +100,10 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
*
|
|
|
* 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)
|
|
|
+ * * attributes: An array of request attributes (only when the first argument is a controller)
|
|
|
+ * * query: An array of request 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)
|
|
|
+ * * alt: an alternative controller to execute in case of an error (can be a controller, a URI, or an array with the controller, the attributes, and the query arguments)
|
|
|
* * 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
|
|
|
*
|
|
@@ -115,7 +115,7 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
public function render($controller, array $options = array())
|
|
|
{
|
|
|
$options = array_merge(array(
|
|
|
- 'path' => array(),
|
|
|
+ 'attributes' => array(),
|
|
|
'query' => array(),
|
|
|
'ignore_errors' => !$this->container->getParameter('kernel.debug'),
|
|
|
'alt' => array(),
|
|
@@ -128,7 +128,7 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
}
|
|
|
|
|
|
if ($this->esiSupport && $options['standalone']) {
|
|
|
- $uri = $this->generateInternalUri($controller, $options['path'], $options['query']);
|
|
|
+ $uri = $this->generateInternalUri($controller, $options['attributes'], $options['query']);
|
|
|
|
|
|
$alt = '';
|
|
|
if ($options['alt']) {
|
|
@@ -145,9 +145,9 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
$subRequest = Request::create($controller, 'get', array(), $request->cookies->all(), array(), $request->server->all());
|
|
|
$subRequest->setSession($request->getSession());
|
|
|
} else {
|
|
|
- $options['path']['_controller'] = $controller;
|
|
|
- $options['path']['_format'] = $request->getRequestFormat();
|
|
|
- $subRequest = $request->duplicate($options['query'], null, $options['path']);
|
|
|
+ $options['attributes']['_controller'] = $controller;
|
|
|
+ $options['attributes']['_format'] = $request->getRequestFormat();
|
|
|
+ $subRequest = $request->duplicate($options['query'], null, $options['attributes']);
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -162,7 +162,7 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
if ($options['alt']) {
|
|
|
$alt = $options['alt'];
|
|
|
unset($options['alt']);
|
|
|
- $options['path'] = isset($alt[1]) ? $alt[1] : array();
|
|
|
+ $options['attributes'] = isset($alt[1]) ? $alt[1] : array();
|
|
|
$options['query'] = isset($alt[2]) ? $alt[2] : array();
|
|
|
|
|
|
return $this->render($alt[0], $options);
|
|
@@ -180,12 +180,12 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
* This method uses the "_internal" route, which should be available.
|
|
|
*
|
|
|
* @param string $controller A controller name to execute (a string like BlogBundle:Post:index), or a relative URI
|
|
|
- * @param array $path An array of path parameters
|
|
|
- * @param array $query An array of query parameters
|
|
|
+ * @param array $attributes An array of request attributes
|
|
|
+ * @param array $query An array of request query parameters
|
|
|
*
|
|
|
* @return string An internal URI
|
|
|
*/
|
|
|
- public function generateInternalUri($controller, array $path = array(), array $query = array())
|
|
|
+ public function generateInternalUri($controller, array $attributes = array(), array $query = array())
|
|
|
{
|
|
|
if (0 === strpos($controller, '/')) {
|
|
|
return $controller;
|
|
@@ -193,7 +193,7 @@ class ControllerResolver extends BaseControllerResolver
|
|
|
|
|
|
$uri = $this->container->getRouterService()->generate('_internal', array(
|
|
|
'controller' => $controller,
|
|
|
- 'path' => $path ? http_build_query($path) : 'none',
|
|
|
+ 'path' => $attributes ? http_build_query($attributes) : 'none',
|
|
|
'_format' => $this->container->getRequestService()->getRequestFormat(),
|
|
|
), true);
|
|
|
|