Exemplo n.º 1
0
 /**
  * @param MessageEntity $entity
  *
  * @return bool
  */
 public function handlePost(MessageEntity $entity)
 {
     $form = $this->getForm();
     if ($this->request->isPost()) {
         $form->setData($this->request->getPost());
         if ($form->isValid()) {
             $entity->populate($this->getPopulateData());
             return $this->saveEntity($entity);
         }
     }
     $form->bind($entity);
     return false;
 }
Exemplo n.º 2
0
 /**
  * @param CampaignEntity $entity
  * @param MessageEntity  $message
  *
  * @return bool
  */
 public function handlePost(CampaignEntity $entity, MessageEntity $message)
 {
     $form = $this->getForm();
     if ($this->request->isPost()) {
         $postData = $this->request->getPost();
         $form->setData($postData);
         if ($form->isValid()) {
             $entity->populate($this->getCampaignData($form));
             $message->populate($this->getMessageData($form));
             $this->handleSystemMessage($entity, $message);
             return $this->saveEntity($entity);
         }
     }
     $form->bind($entity);
     $form->get(CampaignForm::WELCOME_SUBJECT)->setValue($message->getSubject());
     $form->get(CampaignForm::WELCOME_MESSAGE)->setValue($message->getBody());
     return false;
 }