/** * Call the Model and delegate the create or delete action * Feed the Event with the updated model * * @param CouponModel $coupon Model to save * @param CouponCreateOrUpdateEvent $event Event containing data */ protected function createOrUpdateCondition(CouponModel $coupon, CouponCreateOrUpdateEvent $event) { $coupon->setDispatcher($event->getDispatcher()); /** @var ConditionFactory $conditionFactory */ $conditionFactory = $this->conditionFactory; $coupon->createOrUpdateConditions($conditionFactory->serializeConditionCollection($event->getConditions()), $event->getLocale()); $event->setCouponModel($coupon); }