/** * @param Application\Model\ServicePackModel $service * @return Application\Model\ServicePackModel */ public function update(Model\ModelAbstract $service) { if (!strlen((string) $service->getId())) { throw new AppEx\InvalidArgumentException("The Service Pack must have an id"); } $tariffService = TariffPlanService::getInstance(); if ($tariff = $service->getTariffPlanLifeCycle()) { $tariff->setName((string) microtime(true)); $tariff->setId(null); $tariffService->create($tariff); $service->setTariffPlanLifeCycleId($tariff->getId()); } if ($tariff = $service->getTariffPlanServices()) { $tariff->setName((string) microtime(true)); $tariff->setId(null); $tariffService->create($tariff); $service->setTariffPlanServicesId($tariff->getId()); } $lcService = LifeCycleService::getInstance(); if ($lc = $service->getLifeCycle()) { $lc->setName((string) microtime(true)); $lc->setId(null); $lcService->create($lc); $service->setLifeCycleId($lc->getId()); } $restricService = RestrictionService::getInstance(); if ($re = $service->getRestrictions()) { $re->setName((string) microtime(true)); $re->setId(null); $restricService->create($re); $service->setRestrictionsId($re->getId()); } $result = parent::update($service); $steeringListService = SteeringListService::getInstance(); $steeringListService->applySteering($service->getRestrictions(), $service->id); return $result; }