Skip to content
Snippets Groups Projects
Commit a6255145 authored by Bojan Živanović's avatar Bojan Živanović
Browse files

Issue #2909336 by bojanz: No events are fired for coupon CRUD

parent bc5e9fdf
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
* plural = "@count coupons",
* ),
* handlers = {
* "event" = "Drupal\commerce_promotion\Event\CouponEvent",
* "list_builder" = "Drupal\commerce_promotion\CouponListBuilder",
* "storage" = "Drupal\commerce_promotion\CouponStorage",
* "access" = "Drupal\commerce_promotion\CouponAccessControlHandler",
......
<?php
namespace Drupal\commerce_promotion\Event;
use Drupal\commerce_promotion\Entity\CouponInterface;
use Symfony\Component\EventDispatcher\Event;
/**
* Defines the coupon event.
*
* @see \Drupal\commerce_promotion\Event\PromotionEvents
*/
class CouponEvent extends Event {
/**
* The coupon.
*
* @var \Drupal\commerce_promotion\Entity\CouponInterface
*/
protected $coupon;
/**
* Constructs a new CouponEvent.
*
* @param \Drupal\commerce_promotion\Entity\CouponInterface $coupon
* The coupon.
*/
public function __construct(CouponInterface $coupon) {
$this->coupon = $coupon;
}
/**
* Gets the coupon.
*
* @return \Drupal\commerce_promotion\Entity\CouponInterface
* The coupon.
*/
public function getCoupon() {
return $this->coupon;
}
}
......@@ -87,4 +87,69 @@ final class PromotionEvents {
*/
const PROMOTION_TRANSLATION_DELETE = 'commerce_promotion.commerce_promotion.translation_delete';
/**
* Name of the event fired after loading a coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_LOAD = 'commerce_promotion.commerce_promotion_coupon.load';
/**
* Name of the event fired after creating a new coupon.
*
* Fired before the coupon is saved.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_CREATE = 'commerce_promotion.commerce_promotion_coupon.create';
/**
* Name of the event fired before saving a coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_PRESAVE = 'commerce_promotion.commerce_promotion_coupon.presave';
/**
* Name of the event fired after saving a new coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_INSERT = 'commerce_promotion.commerce_promotion_coupon.insert';
/**
* Name of the event fired after saving an existing coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_UPDATE = 'commerce_promotion.commerce_promotion_coupon.update';
/**
* Name of the event fired before deleting a coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_PREDELETE = 'commerce_promotion.commerce_promotion_coupon.predelete';
/**
* Name of the event fired after deleting a coupon.
*
* @Event
*
* @see \Drupal\commerce_promotion\Event\CouponEvent
*/
const COUPON_DELETE = 'commerce_promotion.commerce_promotion_coupon.delete';
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment