
| Current Path : /var/www/html/store/web/modules/contrib/commerce/modules/promotion/src/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/modules/contrib/commerce/modules/promotion/src/CouponStorage.php |
<?php
namespace Drupal\commerce_promotion;
use Drupal\commerce\CommerceContentEntityStorage;
use Drupal\commerce_promotion\Entity\PromotionInterface;
/**
* Defines the coupon storage.
*/
class CouponStorage extends CommerceContentEntityStorage implements CouponStorageInterface {
/**
* {@inheritdoc}
*/
public function loadEnabledByCode($code) {
$coupons = $this->loadByProperties(['code' => $code, 'status' => TRUE]);
return reset($coupons);
}
/**
* {@inheritdoc}
*/
public function loadMultipleByPromotion(PromotionInterface $promotion) {
return $this->loadByProperties(['promotion_id' => $promotion->id()]);
}
}