예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 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;
 }
예제 #4
0
 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;
 }
예제 #5
0
 protected function getEntity()
 {
     $entity = parent::getEntity();
     $this->verifyStageExists($entity);
     return $entity;
 }
예제 #6
0
 protected function getEntity()
 {
     return parent::getEntity()->setState(['form_id' => $this->getRequiredIdentifier('form_id')]);
 }