public function save($flush = false) { App::i()->hook("entity({$this}).save:requests", function () { if ($this->_newProject !== false) { try { if ($this->_newProject) { $this->_newProject->checkPermission('createEvents'); } $this->project = $this->_newProject; } catch (\MapasCulturais\Exceptions\PermissionDenied $e) { if (!App::i()->isWorkflowEnabled()) { throw $e; } $request = new RequestEventProject(); $request->origin = $this; $request->destination = $this->_newProject; $this->_newProject = false; throw new \MapasCulturais\Exceptions\WorkflowRequestTransport($request); } } }); parent::save($flush); }
public function save($flush = false) { if (preg_match('#.php$#', $this->mimeType)) { throw new \MapasCulturais\Exfilesceptions\PermissionDenied($this->ownerUser, $this, 'save'); } parent::save($flush); }
function save($flush = false) { $request = $this->repo()->findOneBy(['requestUid' => $this->generateUid()]); if ($request && !$request->equals($this)) { $request->_applyPostPersistHooks(); } else { // if the origin is a new entity, reset the origin $this->setOrigin($this->getOrigin()); $this->requestUid = $this->generateUid(); parent::save($flush); } }
function save($flush = false) { try { parent::save($flush); } catch (\MapasCulturais\Exceptions\PermissionDenied $e) { if (!App::i()->isWorkflowEnabled()) { throw $e; } $app = App::i(); $app->disableAccessControl(); $this->status = self::STATUS_PENDING; parent::save($flush); $app->enableAccessControl(); $request = new RequestEventOccurrence(); $request->origin = $this->event; $request->destination = $this->space; $request->eventOccurrence = $this; $request->save(true); throw new \MapasCulturais\Exceptions\WorkflowRequest([$request]); } }