Salut à tous !
J'essaie d'afficher mes posts par topic mais je me retrouve avec une erreur du genre :
Voici mon controller :Notice: Undefined index: post in /homepages/44/d319387792/htdocs/skydreamsoft/vendor/doctrine/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php line 95
Mon PostRepository :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 public function topicAction(Topic $topic) { $listePosts = $this->getDoctrine() ->getEntityManager() ->getRepository('SdsForumBundle:Post') ->findAllByTopicIdOrderByDESC($topic->getId()); return $this->render('SdsForumBundle:Forum:topic.html.twig', array('topic' => $topic, 'listePosts' => $listePosts)); }
ma vue :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 public function findAllByTopicIdOrderByDESC($id) { $qb = $this->createQueryBuilder('p') ->join('p.topic', 't') ->addSelect('t') ->where('p.topic = :id') ->setParameter('id', $id) ->orderBy('p.date', 'DESC'); return $qb->getQuery() ->getResult(); }
Si quelqu'un aurait une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <div id="forum"> <div id="globalforum"> <div id="catforums"> <h2>{{ topic.titre }}</h2> {% for post in listePosts %} {{ post.texte }} {% endfor %} </div> </div> </div>
Partager