From bd6207832e38ffa4669216d3dd94030889e19f72 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 12 May 2015 23:38:45 +0200 Subject: [PATCH] replace docs for removed `forward()` method The `forward()` method was removed from the `HttpKernel` class in the FrameworkBundle in Symfony 2.3. Instead, the current request needs to be duplicated and handled by the kernel's `handle()` method. --- cookbook/controller/service.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 50f781754b6..4fa3af4deb5 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -258,7 +258,13 @@ controller: :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::forward` (service: ``http_kernel``) .. code-block:: php - $httpKernel->forward($controller, $path, $query); + use Symfony\Component\HttpKernel\HttpKernelInterface; + // ... + + $request = ...; + $attributes = array_merge($path, array('_controller' => $controller)); + $subRequest = $request->duplicate($query, null, $attributes); + $httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::generateUrl` (service: ``router``) .. code-block:: php