protected function getEntity() { $entity = parent::getEntity(); // If no user information is provided, default to the current session user. if (empty($entity->user_id) && $this->auth->getUserId()) { $entity->setState(['user_id' => $this->auth->getUserId()]); } return $entity; }
protected function getEntity() { $entity = parent::getEntity(); // Add user id if this is not provided if (empty($entity->user_id) && $this->auth->getUserId()) { $entity->setState(['user_id' => $this->auth->getUserId()]); } return $entity; }
public function interact() { try { return parent::interact(); } catch (ValidatorException $e) { // If a file was uploaded, it must be purged after a failed upload. // Otherwise storage will be filled with junk files. if ($this->fs->has($this->upload->file)) { $this->fs->delete($this->upload->file); } // Pass the exception. throw $e; } }
protected function getEntity() { $entity = parent::getEntity(); // Retrieve message type and data provider // from incoming message when replying to a message if (!empty($this->payload['parent_id'])) { $parent = $this->repo->get($this->payload['parent_id']); $entity->setState(['type' => $parent->type, 'data_provider' => $parent->data_provider]); } // If no user information is provided, default to the current session user. if (empty($entity->user_id) && $this->auth->getUserId()) { $entity->setState(['user_id' => $this->auth->getUserId()]); } return $entity; }
protected function getEntity() { $entity = parent::getEntity(); // If no user information is provided, default to the current session user. if (empty($entity->user_id) && empty($entity->author_email) && empty($entity->author_realname) && $this->auth->getUserId()) { $entity->setState(['user_id' => $this->auth->getUserId()]); } // If status is not set.. if (empty($entity->status)) { // .. check if the post requires approval // .. and set a default status if ($this->repo->doesPostRequireApproval($entity->form_id)) { $entity->setState(['status' => 'draft']); } else { $entity->setState(['status' => 'published']); } } return $entity; }
protected function getEntity() { $entity = parent::getEntity(); $this->verifyStageExists($entity); return $entity; }
protected function getEntity() { return parent::getEntity()->setState(['form_id' => $this->getRequiredIdentifier('form_id')]); }