/** * @param DownloadTokenModel $downloadToken * @return DownloadTokenModel */ public function update(models\ModelAbstract $downloadToken) { if (!$downloadToken instanceof DownloadTokenModel) { throw new InvalidArgumentException('Supplied data must be a download token model'); } return parent::update($downloadToken); }
/** * @param \Application\Model\SimModel $sim * @return \Application\Model\SimModel */ public function update(Model\ModelAbstract $sim) { if (!$sim instanceof SimModel) { throw new InvalidArgumentException("Model must be a sim"); } $originSim = $this->load($sim->id); $result = parent::update($sim); if (!empty($result) && $sim->getApns() && !is_null($sim->getStaticIpAddress())) { if (implode(' ', $originSim->getApns()) != implode(' ', $sim->getApns()) || $sim->getStaticIpAddress() != $originSim->getStaticIpAddress()) { $this->changeSimApn($sim); } } return $result; }
public function update(models\ModelAbstract $model) { if (!strlen((string) $model->getId())) { throw new AppEx\InvalidArgumentException('Supplied supplServices model must have an Id', \Application\Error\ValidationCodes::MODEL_SUPPL_SERVICE_PACK); } if ($model->getPublished() == \Application\Model\SupplServicesModel::STATUS_PUBLISHED) { // If the supplementary service pack is published, applicationOriginatedSmsMsisdn, // currency can't be updated if ($model->getCurrency()) { unset($model->currency); } } return parent::update($model); }
public function putAction() { $this->_helper->output('json'); $item = $this->_getItem(); $data = $this->_helper->requestData(true); // Check permissions $this->_helper->allowed('update', $item); // Filter data $data = $this->_helper->filter($data)->blacklist(array_merge($this->_blacklistCreateFields, $this->_blacklistUpdateFields)); $itemClass = get_class($item); $newItem = new $itemClass($data); $this->_helper->filterNotAllowedFields('update_field', $item, $newItem); $item->importData($newItem->exportData()); $this->_preUpdate($item); // Perform the update $this->_service->update($item); $this->view->data = $item->getId(); }
public function update(ModelAbstract $model) { $model->userId = \App::getUserLogged()->id; return parent::update($model); }
/** * Update a model * * @param ModelAbstract $model * @return ModelAbstract */ public function update(ModelAbstract $model) { $result = parent::update($model); $this->_sendEvent('update', $model); return $result; }
/** * @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; }