示例#1
0
 /**
  * Handler for add comment to article
  * @param ArrayHash $values
  */
 public function addComment(ArrayHash $values)
 {
     try {
         $comment = new \App\Model\Entities\PageComment((array) $values);
         $comment->setEditor($this->getUser()->getIdentity());
         $comment->setAuthor($comment->getEditor());
         $comment->setCreated(new DateTime());
         $comment->setUpdated(new DateTime());
         $this->staticPageService->createComment($comment, $this->getEntity());
     } catch (Exceptions\DataErrorException $ex) {
         $this->handleDataSave(null, "this", $ex);
     }
     if (!$this->isAjax()) {
         $this->redirect("this");
     } else {
         $this->redrawControl("commentsData");
     }
 }