public function Promotion::getCouponIds in Commerce Core 8.2
Gets the coupon IDs.
Return value
int[] The coupon IDs.
Overrides PromotionInterface::getCouponIds
2 calls to Promotion::getCouponIds()
- Promotion::getCouponIndex in modules/
promotion/ src/ Entity/ Promotion.php - Gets the index of the given coupon.
- Promotion::hasCoupon in modules/
promotion/ src/ Entity/ Promotion.php - Checks whether the promotion has a given coupon.
File
- modules/
promotion/ src/ Entity/ Promotion.php, line 318
Class
- Promotion
- Defines the promotion entity class.
Namespace
Drupal\commerce_promotion\EntityCode
public function getCouponIds() {
$coupon_ids = [];
foreach ($this
->get('coupons') as $field_item) {
$coupon_ids[] = $field_item->target_id;
}
return $coupon_ids;
}