public function voirAction(Article $article)
 {
     $em = $this->getDoctrine()->getManager();
     $request = $this->get('request');
     $liste_articleCompetence = $this->getDoctrine()->getManager()->getRepository('SdzBlogBundle:ArticleCompetence')->findByArticle($article->getId());
     return $this->render('SdzBlogBundle:Blog:voir.html.twig', array('article' => $article, 'liste_articleCompetence' => $liste_articleCompetence));
 }
Example #2
0
 public function voirAction(Article $article, Form $form = null)
 {
     // On récupère l'EntityManager
     $em = $this->getDoctrine()->getManager();
     // On récupère la liste des commentaires
     // On n'a pas joint les commentaires depuis l'article car il faut de toute façon
     // refaire une jointure pour avoir les utilisateurs des commentaires
     $commentaires = $em->getRepository('SdzBlogBundle:Commentaire')->getByArticle($article->getId());
     // On crée le formulaire d'ajout de commentaire pour le passer à la vue
     if (null === $form) {
         $form = $this->getCommentaireForm($article);
     }
     // Puis modifiez la ligne du render comme ceci, pour prendre en compte les variables :
     return $this->render('SdzBlogBundle:Blog:voir.html.twig', array('article' => $article, 'form' => $form->createView(), 'commentaires' => $commentaires));
 }