You are here

public function OrderItemStorageInterface::createFromPurchasableEntity in Commerce Core 8.2

Constructs a new order item using the given purchasable entity.

The new order item isn't saved.

Parameters

\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.

array $values: (optional) An array of values to set, keyed by property name.

Return value

\Drupal\commerce_order\Entity\OrderItemInterface The created order item.

1 method overrides OrderItemStorageInterface::createFromPurchasableEntity()
OrderItemStorage::createFromPurchasableEntity in modules/order/src/OrderItemStorage.php
Constructs a new order item using the given purchasable entity.

File

modules/order/src/OrderItemStorageInterface.php, line 26

Class

OrderItemStorageInterface
Defines the interface for order item storage.

Namespace

Drupal\commerce_order

Code

public function createFromPurchasableEntity(PurchasableEntityInterface $entity, array $values = []);