/** * Manage how a Condition is updated * * @param Coupon $coupon Coupon Model * @param ConditionCollection $conditions Condition collection */ protected function manageConditionUpdate(Coupon $coupon, ConditionCollection $conditions) { $couponEvent = new CouponCreateOrUpdateEvent($coupon->getCode(), $coupon->getType(), $coupon->getTitle(), $coupon->getEffects(), $coupon->getShortDescription(), $coupon->getDescription(), $coupon->getIsEnabled(), $coupon->getExpirationDate(), $coupon->getIsAvailableOnSpecialOffers(), $coupon->getIsCumulative(), $coupon->getIsRemovingPostage(), $coupon->getMaxUsage(), $coupon->getLocale(), $coupon->getFreeShippingForCountries(), $coupon->getFreeShippingForModules(), $coupon->getPerCustomerUsageCount()); $couponEvent->setCouponModel($coupon); $couponEvent->setConditions($conditions); $eventToDispatch = TheliaEvents::COUPON_CONDITION_UPDATE; // Dispatch Event to the Action $this->dispatch($eventToDispatch, $couponEvent); $this->adminLogAppend(AdminResources::COUPON, AccessManager::UPDATE, sprintf('Coupon %s (ID %s) conditions updated', $couponEvent->getCouponModel()->getTitle(), $couponEvent->getCouponModel()->getType()), $couponEvent->getCouponModel()->getId()); }