mardi 3 avril 2018

Get unjoined values with dql

how can i get the unjoined values with dql ? The problem in this code is that i'm getting only posts that have comments ..

public function getAllPostsDQL()
{
    $q = $this->getEntityManager()
        ->createQuery('SELECT p.type,p.date,p.urlImage,p.nom,u.nom as nomU,u.prenom as prenomU ,COUNT(co) as nb,MAX(co.date) as maxDate FROM PidevBundle:Publication p LEFT OUTER JOIN 
           PidevBundle:Commentaire co WITH co.idPublication=p
           JOIN PidevBundle:User u WITH p.idUser=u
           ');

    return $q->getResult();
}




Aucun commentaire:

Enregistrer un commentaire