Beispiel #1
0
 /**
  * Given the form parameters validates the form compiled and return a partial with the list of the updated comments or a partial of the old list and an error message.
  *
  * @param sfWebRequest $request
  * @param sfForm $form
  * @param Issue $issue
  * @return string
  */
 protected function processForm(sfWebRequest $request, sfForm $form, Issue $issue)
 {
     $form_parameters = $request->getParameter($form->getName());
     $form_parameters['created_at'] = date('Y-m-d H:i:s', time());
     $form_parameters['profile_id'] = $this->getUser()->getProfile()->getId();
     $form->bind($form_parameters);
     if ($form->isValid()) {
         $comment = $form->save();
         return $this->renderPartial('idComment/comments_list', array('issue' => $comment->getIssue()));
     }
     return $this->renderPartial('idComment/comments_list', array('issue' => $issue, 'global_errors' => $form->getGlobalErrors(), 'body_errors' => $form['body']->getError()));
 }