diff --git a/core/modules/rest/src/RequestHandler.php b/core/modules/rest/src/RequestHandler.php index d917e41..c829abc 100644 --- a/core/modules/rest/src/RequestHandler.php +++ b/core/modules/rest/src/RequestHandler.php @@ -7,6 +7,7 @@ namespace Drupal\rest; +use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; @@ -27,15 +28,17 @@ class RequestHandler implements ContainerAwareInterface { /** * Handles a web API request. * - * @param Symfony\Component\HttpFoundation\Request $request + * @param \Drupal\Core\Routing\RouteMatchInterface $route_match + * The route match. + * @param \Symfony\Component\HttpFoundation\Request $request * The HTTP request object. * * @return \Symfony\Component\HttpFoundation\Response * The response object. */ - public function handle(Request $request) { + public function handle(RouteMatchInterface $route_match, Request $request) { - $plugin = $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT)->getDefault('_plugin'); + $plugin = $route_match->getRouteObject()->getDefault('_plugin'); $method = strtolower($request->getMethod()); $resource = $this->container @@ -74,7 +77,7 @@ public function handle(Request $request) { // Determine the request parameters that should be passed to the resource // plugin. - $route_parameters = $request->attributes->get('_route_params'); + $route_parameters = $$request->attributes->get('_route_params'); $parameters = array(); // Filter out all internal parameters starting with "_". foreach ($route_parameters as $key => $parameter) { @@ -87,7 +90,7 @@ public function handle(Request $request) { // All REST routes are restricted to exactly one format, so instead of // parsing it out of the Accept headers again, we can simply retrieve the // format requirement. If there is no format associated, just pick JSON. - $format = $request->attributes->get(RouteObjectInterface::ROUTE_OBJECT)->getRequirement('_format') ?: 'json'; + $format = $route_match->getRouteObject()->getRequirement('_format') ?: 'json'; try { $response = call_user_func_array(array($resource, $method), array_merge($parameters, array($unserialized, $request))); } diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php index 7ce404d..739a365 100644 --- a/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -139,7 +139,7 @@ public function resetPass($uid, $timestamp, $hash) { * Returns either a redirect to the user page or the render * array of the login form. */ - public function userPage(Request $request) { + public function userPage() { $user = $this->currentUser(); if ($user->id()) { $response = $this->redirect('entity.user.canonical', array('user' => $user->id()));