public function init() { $this->_spSrv = ServicePackService::getInstance(); $this->_lifeCycleSrv = LifeCycleService::getInstance(); $this->_restrictionsSrv = RestrictionService::getInstance(); $this->_tariffSrv = TariffPlanService::getInstance(); $this->_orgSrv = \Application\Service\OrgService::getInstance(); }
public function init() { $this->_spSrv = ServicePackService::getInstance(); $this->_lifeCycleSrv = LifeCycleService::getInstance(); $this->_restrictionsSrv = RestrictionService::getInstance(); $this->_tariffSrv = TariffPlanService::getInstance(); $this->_steeringListSrv = SteeringListService::getInstance(); }
public function isValid($value) { $this->_messages = array(); if (!is_string($value)) { $message = $this->_createMessage(self::ERROR_INVALID_TYPE, $value); $this->_messages[self::ERROR_INVALID_TYPE] = $message; return false; } $service = RestrictionService::getInstance(); try { $item = $service->load($value); } catch (Application\Exceptions\GlobalServiceException $e) { $message = $this->_createMessage(self::ERROR_ON_CONNECTION, $value); $this->_messages[self::ERROR_ON_CONNECTION] = $message; return false; } if (!isset($item)) { $message = $this->_createMessage(self::ERROR_RESTRICTIONS_NOT_FOUND, $value); $this->_messages[self::ERROR_RESTRICTIONS_NOT_FOUND] = $message; return false; } return true; }
public function delete($model) { if (is_string($model)) { $model = $this->load($model); } if (!$model instanceof ServicePackModel) { throw new AppEx\InvalidArgumentException('Supplied service pack model must have Id'); } if ($model->getCustomerCount() !== 0) { throw new AppEx\ForbiddenException('Delete service pack assigned to a customer is not allowed.'); } $result = parent::delete($model); if ($model->getLifeCycleId()) { try { LifeCycleService::getInstance()->delete($model->getLifeCycleId()); } catch (\Exception $e) { \App::log()->warn($e); } } if ($model->getRestrictionsId()) { try { RestrictionService::getInstance()->delete($model->getRestrictionsId()); } catch (\Exception $e) { \App::log()->warn($e); } } if ($model->getTariffPlanLifeCycleId()) { try { TariffPlanService::getInstance()->delete($model->getTariffPlanLifeCycleId(), TariffPlanService::TYPE_LIFECYCLE); } catch (\Exception $e) { \App::log()->warn($e); } } if ($model->getTariffPlanServicesId()) { try { TariffPlanService::getInstance()->delete($model->getTariffPlanServicesId(), TariffPlanService::TYPE_SERVICES); } catch (\Exception $e) { \App::log()->warn($e); } } $steeringListService = SteeringListService::getInstance(); if ($steeringList = $steeringListService->loadByServicePack($model->id)) { $steeringListService->delete($steeringList); } return true; }