class AlterProductPurchasedEntityEvent in Commerce Google Tag Manager 8.2
Same name and namespace in other branches
- 8 src/Event/AlterProductPurchasedEntityEvent.php \Drupal\commerce_google_tag_manager\Event\AlterProductPurchasedEntityEvent
Event to alter the Enhanced Ecommerce product.
Event to alter product mapped from a purchased entity.
Hierarchy
- class \Drupal\commerce_google_tag_manager\Event\AlterProductPurchasedEntityEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of AlterProductPurchasedEntityEvent
2 files declare their use of AlterProductPurchasedEntityEvent
File
- src/
Event/ AlterProductPurchasedEntityEvent.php, line 15
Namespace
Drupal\commerce_google_tag_manager\EventView source
class AlterProductPurchasedEntityEvent extends Event {
/**
* The Commerce GTM product class.
*
* @var \Drupal\commerce_google_tag_manager\Product
*/
private $product;
/**
* The order item.
*
* @var \Drupal\commerce_order\Entity\OrderItemInterface
*/
private $orderItem;
/**
* The purchased entity if available.
*
* @var \Drupal\commerce\PurchasableEntityInterface|null
*/
private $purchasedEntity;
/**
* Constructs a AlterProductPurchasedEntityEvent object.
*
* @param \Drupal\commerce_google_tag_manager\Product $product
* The Commerce GTM product class.
* @param \Drupal\commerce_order\Entity\OrderItemInterface $order_item
* The order item.
* @param \Drupal\commerce\PurchasableEntityInterface|null $purchased_entity
* (optional) The purchased entity.
*/
public function __construct(Product $product, OrderItemInterface $order_item, PurchasableEntityInterface $purchased_entity = NULL) {
$this->product = $product;
$this->orderItem = $order_item;
$this->purchasedEntity = $purchased_entity;
}
/**
* Get the product.
*
* @return \Drupal\commerce_google_tag_manager\Product
* The Commerce GTM product object.
*/
public function getProduct() {
return $this->product;
}
/**
* Get the order item.
*
* @return \Drupal\commerce_order\Entity\OrderItemInterface
* The order item.
*/
public function getOrderItem() {
return $this->orderItem;
}
/**
* Get the purchased entity or null if not available.
*
* @return \Drupal\commerce\PurchasableEntityInterface|null
* The purchased entity.
*/
public function getPurchasedEntity() {
return $this->purchasedEntity;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AlterProductPurchasedEntityEvent:: |
private | property | The order item. | |
AlterProductPurchasedEntityEvent:: |
private | property | The Commerce GTM product class. | |
AlterProductPurchasedEntityEvent:: |
private | property | The purchased entity if available. | |
AlterProductPurchasedEntityEvent:: |
public | function | Get the order item. | |
AlterProductPurchasedEntityEvent:: |
public | function | Get the product. | |
AlterProductPurchasedEntityEvent:: |
public | function | Get the purchased entity or null if not available. | |
AlterProductPurchasedEntityEvent:: |
public | function | Constructs a AlterProductPurchasedEntityEvent object. |