Commit e8828482 authored by webchick's avatar webchick

Issue #1851768 by klausi: Rename 'plugin' property in REST routes to '_plugin'.

parent 22fa7f4d
......@@ -62,11 +62,8 @@ public function routes() {
$prefix = strtr($this->plugin_id, ':', '/');
$route = new Route("/$prefix/{id}", array(
'_controller' => 'Drupal\rest\RequestHandler::handle',
// @todo Once http://drupal.org/node/1793520 is committed we will have
// route object avaialble in the controller so 'plugin' property
// should be changed to '_plugin'.
// @see RequestHandler::handle().
'plugin' => $this->plugin_id,
// Pass the resource plugin ID along as default property.
'_plugin' => $this->plugin_id,
), array(
// The HTTP method is a requirement for this route.
'_method' => $method,
......
......@@ -20,19 +20,16 @@ class RequestHandler extends ContainerAware {
/**
* Handles a web API request.
*
* @param string $plugin
* The resource type plugin.
* @param Symfony\Component\HttpFoundation\Request $request
* The HTTP request object.
* @param mixed $id
* The resource ID.
*
* @todo Remove $plugin as argument. After http://drupal.org/node/1793520 is
* committed we would be able to access route object as
* $request->attributes->get('_route'). Then we will get plugin as
* '_plugin' property of route object.
* @return \Symfony\Component\HttpFoundation\Response
* The response object.
*/
public function handle($plugin, Request $request, $id = NULL) {
public function handle(Request $request, $id = NULL) {
$plugin = $request->attributes->get('_route')->getDefault('_plugin');
$method = strtolower($request->getMethod());
$resource = $this->container
->get('plugin.manager.rest')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment