You are here

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

Class

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