Наследование: extends Newscoop\Form
Пример #1
0
 /**
  * @Acl(action="edit")
  */
 public function updateAction()
 {
     if (!$this->editForm->isValid($this->_getAllParams())) {
         $return = array('status' => 101, 'message' => 'invalid', 'data' => $this->editForm->getMessages());
         $this->_helper->json($return);
     }
     try {
         $values = $this->editForm->getValues();
         $comment = $this->commentRepository->find($values['id']);
         $comment = $this->commentRepository->update($comment, $values);
         $this->commentRepository->flush();
     } catch (Exception $e) {
         $return = array('status' => $e->getCode(), 'message' => $e->getMessage(), 'data' => array());
         $this->_helper->json($return);
     }
     $return = array('status' => 100, 'message' => 'succesful', 'data' => array('comment' => $comment->getId()));
     $this->_helper->json($return);
 }