class CartEmptyEvent in Commerce Core 8.2
Defines the cart empty event.
Hierarchy
- class \Drupal\commerce\EventBase extends \Drupal\Component\EventDispatcher\Event
- class \Drupal\commerce_cart\Event\CartEmptyEvent
Expanded class hierarchy of CartEmptyEvent
See also
\Drupal\commerce_cart\Event\CartEvents
2 files declare their use of CartEmptyEvent
- CartEventSubscriber.php in modules/
promotion/ src/ EventSubscriber/ CartEventSubscriber.php - CartManager.php in modules/
cart/ src/ CartManager.php
File
- modules/
cart/ src/ Event/ CartEmptyEvent.php, line 13
Namespace
Drupal\commerce_cart\EventView source
class CartEmptyEvent extends EventBase {
/**
* The cart order.
*
* @var \Drupal\commerce_order\Entity\OrderInterface
*/
protected $cart;
/**
* The removed order items.
*
* @var \Drupal\commerce_order\Entity\OrderItemInterface[]
*/
protected $orderItems;
/**
* Constructs a new CartEmptyEvent.
*
* @param \Drupal\commerce_order\Entity\OrderInterface $cart
* The cart order.
* @param \Drupal\commerce_order\Entity\OrderItemInterface[] $order_items
* The removed order items.
*/
public function __construct(OrderInterface $cart, array $order_items) {
$this->cart = $cart;
$this->orderItems = $order_items;
}
/**
* Gets the cart order.
*
* @return \Drupal\commerce_order\Entity\OrderInterface
* The cart order.
*/
public function getCart() {
return $this->cart;
}
/**
* Gets the removed order items.
*
* @return \Drupal\commerce_order\Entity\OrderItemInterface[]
* The removed order items.
*/
public function getOrderItems() {
return $this->orderItems;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CartEmptyEvent:: |
protected | property | The cart order. | |
CartEmptyEvent:: |
protected | property | The removed order items. | |
CartEmptyEvent:: |
public | function | Gets the cart order. | |
CartEmptyEvent:: |
public | function | Gets the removed order items. | |
CartEmptyEvent:: |
public | function | Constructs a new CartEmptyEvent. |