public function showAction(Post $post) { if (!$post) { throw $this->createNotFoundException('Aucun article n\'existe avec cet identifiant ' . $post->getSlug()); } $comment = new Comment(); $comment->setPost($post); $form = $this->createForm(CommentType::class, $comment); return $this->render('BlogBundle/Post/show.html.twig', array('post' => $post, 'form' => $form->createView())); }