Exemplo n.º 1
0
 /**
  * Callback method, that is called once form is successfully submitted, without validation errors.
  *
  * @param Form $form
  * @param Nette\Utils\ArrayHash $values
  */
 public function formSucceeded(Form $form, $values)
 {
     if ($this->note === NULL) {
         $note = new Note($this->user->getIdentity());
         $this->em->persist($note);
     } else {
         $note = $this->note;
     }
     $note->setName($values->name);
     $note->setText($values->text);
     if ($values->pad === NULL) {
         $note->setPad(NULL);
     } else {
         $note->setPad($this->padRepository->find($values->pad));
     }
     $this->em->flush();
     $this->onSuccess($this);
 }