Ejemplo n.º 1
0
 public function createAction($blog_id)
 {
     $blog = $this->getBlog($blog_id);
     $comment = new Comment();
     $comment->setBlog($blog);
     $request = $this->getRequest();
     $form = $this->createForm(new CommentType(), $comment);
     $form->bindRequest($request);
     if ($form->isValid()) {
         // TODO: Persist the comment entity
         return $this->redirect($this->generateUrl('ThijsBlogBundle_blog_show', array('id' => $comment->getBlog()->getId())) . '#comment-' . $comment->getId());
     }
     return $this->render('ThijsBlogBundle:Comment:create.html.twig', array('comment' => $comment, 'form' => $form->createView()));
 }