You are here

public function CartAddResource::__construct in Commerce Cart API 8

Constructs a new CartAddResource object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

array $serializer_formats: The available serialization formats.

\Psr\Log\LoggerInterface $logger: A logger instance.

\Drupal\commerce_cart\CartProviderInterface $cart_provider: The cart provider.

\Drupal\commerce_cart\CartManagerInterface $cart_manager: The cart manager.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\commerce_order\Resolver\ChainOrderTypeResolverInterface $chain_order_type_resolver: The chain order type resolver.

\Drupal\commerce_store\CurrentStoreInterface $current_store: The current store.

\Drupal\commerce_price\Resolver\ChainPriceResolverInterface $chain_price_resolver: The chain base price resolver.

\Drupal\Core\Session\AccountInterface $current_user: The current user.

\Drupal\Core\Entity\EntityRepositoryInterface $entity_repository: The entity repository.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides CartResourceBase::__construct

File

src/Plugin/rest/resource/CartAddResource.php, line 117

Class

CartAddResource
Creates order items for the session's carts.

Namespace

Drupal\commerce_cart_api\Plugin\rest\resource

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, CartProviderInterface $cart_provider, CartManagerInterface $cart_manager, EntityTypeManagerInterface $entity_type_manager, ChainOrderTypeResolverInterface $chain_order_type_resolver, CurrentStoreInterface $current_store, ChainPriceResolverInterface $chain_price_resolver, AccountInterface $current_user, EntityRepositoryInterface $entity_repository) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger, $cart_provider, $cart_manager);
  $this->entityTypeManager = $entity_type_manager;
  $this->orderItemStorage = $entity_type_manager
    ->getStorage('commerce_order_item');
  $this->chainOrderTypeResolver = $chain_order_type_resolver;
  $this->currentStore = $current_store;
  $this->chainPriceResolver = $chain_price_resolver;
  $this->currentUser = $current_user;
  $this->entityRepository = $entity_repository;
}