private function isCouponEligible(CouponInterface $coupon, PromotionInterface $promotion, UserInterface $user) { $countPlacedOrders = $this->subjectRepository->countByUserAndCoupon($user, $coupon); // <= because we need to include the cart orders as well if ($countPlacedOrders <= $coupon->getPerUserUsageLimit()) { $this->dispatcher->dispatch(SyliusPromotionEvents::COUPON_ELIGIBLE, new GenericEvent($promotion)); return true; } return false; }