You are here

protected function CartRemoveItemResource::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/CartRemoveItemResource.php, line 49

Class

CartRemoveItemResource
Provides a cart collection resource for current session.

Namespace

Drupal\commerce_cart_api\Plugin\rest\resource

Code

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;
}