public function delete($id)
 {
     if (!($id instanceof SupplServicesModel || is_string($id))) {
         throw new InvalidArgumentException("Invalid model. Not an supplementary service");
     }
     return parent::delete($id);
 }
Exemplo n.º 2
0
 public function delete($idOrModel)
 {
     if ($idOrModel instanceof models\ModelAbstract) {
         $model = $idOrModel;
     } else {
         $model = $this->load($idOrModel);
     }
     $result = parent::delete($model);
     WatcherService::getInstance()->removeByScope('apiId', $model->id);
 }
 /**
  * Delete one model
  *
  * @param  string|ModelAbstract $idOrModel
  * @return boolean
  */
 public function delete($idOrModel)
 {
     if ($idOrModel instanceof ModelAbstract) {
         $model = $idOrModel;
     } else {
         $model = $this->load($idOrModel);
     }
     $result = parent::delete($model);
     $this->_sendEvent('delete', $model);
     return $result;
 }
 public function delete($supervGroup)
 {
     $count = $this->countSims($supervGroup);
     if ($count > 0) {
         throw new ValidateException("Supervision group is not empty (has {$count} sims)");
     }
     if (strtolower($supervGroup->id) == 'default_group') {
         throw new ValidateException("It not possible remove default supervision group");
     }
     return parent::delete($supervGroup);
 }
 public function deleteAction()
 {
     $this->_helper->output('json');
     $item = $this->_getItem();
     // Check permissions
     $this->_helper->allowed('delete', $item);
     $this->_preDelete($item);
     // Remove the user
     $this->_service->delete($item->id);
     $this->view->data = true;
 }
 public function delete($commercialGroup)
 {
     if (is_string($commercialGroup)) {
         $commercialGroup = new CommercialGroupModel(array('id' => $commercialGroup));
     }
     if (!$commercialGroup instanceof CommercialGroupModel) {
         throw new AppEx\InvalidArgumentException('No supplied commericial group Id or model');
     }
     if (is_null($commercialGroup->getSubscriberCount())) {
         $commercialGroup = $this->load($commercialGroup->getId());
     }
     if ($commercialGroup->getSubscriberCount() !== 0) {
         throw new AppEx\InvalidArgumentException('Supplied commericial group has subscriptions');
     }
     return parent::delete($commercialGroup);
 }
 /**
  * @param  string $id
  * @return void
  */
 public function delete($idOrModel)
 {
     if ($idOrModel instanceof DownloadTokenModel) {
         $downloadToken = $idOrModel;
     } else {
         $downloadToken = $this->load($idOrModel);
     }
     return parent::delete($downloadToken);
 }
 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;
 }