You are here

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

Class

CartClearResource
Clear order items and reset the cart to initial.

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';
  $route
    ->setOption('parameters', $parameters);
  return $route;
}