/** * @When /^I try to delete ("[^"]+" coupon) related to (this promotion)$/ */ public function iTryToDeleteCoupon(PromotionCouponInterface $coupon, PromotionInterface $promotion) { try { $promotion->removeCoupon($coupon); $this->couponRepository->remove($coupon); } catch (ForeignKeyConstraintViolationException $exception) { $this->sharedStorage->set('last_exception', $exception); } }
/** * @When /^I delete ("[^"]+" coupon) related to (this promotion)$/ */ public function iDeleteCouponRelatedTo(CouponInterface $coupon, PromotionInterface $promotion) { $this->sharedStorage->set('coupon', $coupon); $this->couponRepository->remove($coupon); $promotion->removeCoupon($coupon); }