protected function CartUpdateItemResource::getBaseRoute in Commerce Cart API 8
Gets the base route for a particular method.
Parameters
string $canonical_path: The canonical path for the resource.
string $method: The HTTP method to be used for the route.
Return value
\Symfony\Component\Routing\Route The created base route.
Overrides ResourceBase::getBaseRoute
File
- src/
Plugin/ rest/ resource/ CartUpdateItemResource.php, line 128
Class
- CartUpdateItemResource
- Resource for updating the quantity of a cart's single order item.
Namespace
Drupal\commerce_cart_api\Plugin\rest\resourceCode
protected function getBaseRoute($canonical_path, $method) {
$route = parent::getBaseRoute($canonical_path, $method);
$parameters = $route
->getOption('parameters') ?: [];
$parameters['commerce_order']['type'] = 'entity:commerce_order';
$parameters['commerce_order_item']['type'] = 'entity:commerce_order_item';
$route
->setOption('parameters', $parameters);
return $route;
}