Browse Source

Optimisation de la requete récupérant les elements.

bastien 13 years ago
parent
commit
7464463bf0

+ 6 - 3
src/Muzich/CoreBundle/Repository/ElementRepository.php View File

64
       FROM MuzichCoreBundle:Element e 
64
       FROM MuzichCoreBundle:Element e 
65
       LEFT JOIN e.group g JOIN e.type et JOIN e.tags t $query_with 
65
       LEFT JOIN e.group g JOIN e.type et JOIN e.tags t $query_with 
66
         JOIN e.owner eu $join_personal
66
         JOIN e.owner eu $join_personal
67
-      ORDER BY e.date_added DESC "
67
+      ORDER BY e.created DESC "
68
     ;
68
     ;
69
     
69
     
70
     $query = $this->getEntityManager()
70
     $query = $this->getEntityManager()
88
   {
88
   {
89
     return $this->getEntityManager()
89
     return $this->getEntityManager()
90
       ->createQuery('
90
       ->createQuery('
91
-        SELECT e FROM MuzichCoreBundle:Element e
91
+        SELECT e, u, g, t FROM MuzichCoreBundle:Element e
92
         JOIN e.owner u
92
         JOIN e.owner u
93
+        JOIN e.group g
94
+        JOIN e.tags t
93
         WHERE u.id = :uid
95
         WHERE u.id = :uid
94
         ORDER BY e.created DESC'
96
         ORDER BY e.created DESC'
95
       )
97
       )
110
   {
112
   {
111
     return $this->getEntityManager()
113
     return $this->getEntityManager()
112
       ->createQuery('
114
       ->createQuery('
113
-        SELECT e FROM MuzichCoreBundle:Element e
115
+        SELECT e, u, g, t FROM MuzichCoreBundle:Element e
114
         JOIN e.owner u
116
         JOIN e.owner u
115
         JOIN e.group g
117
         JOIN e.group g
118
+        JOIN e.tags t
116
         WHERE g.id = :gid
119
         WHERE g.id = :gid
117
         ORDER BY e.created DESC'
120
         ORDER BY e.created DESC'
118
       )
121
       )

+ 1 - 0
src/Muzich/HomeBundle/Controller/ShowController.php View File

66
     return $this->getDoctrine()
66
     return $this->getDoctrine()
67
       ->getRepository('MuzichCoreBundle:Element')
67
       ->getRepository('MuzichCoreBundle:Element')
68
       ->$findBy($entity_id, 10)
68
       ->$findBy($entity_id, 10)
69
+      
69
       ->execute()
70
       ->execute()
70
     ;
71
     ;
71
   }
72
   }