Home:ALL Converter>AND in LEFT JOIN with Doctrine

AND in LEFT JOIN with Doctrine

Ask Time:2021-09-22T05:54:24         Author:jsmarchewka

Json Formatter

How can i add AND in LEFT JOIN like this SELECT * FROM photo LEFT JOIN liked_photo lp on photo.id = lp.photo_id AND lp.user_id = 6 WHERE photo.is_public = 1 ?

`{`
    `return $this->createQueryBuilder('photo')`
        `->leftJoin("photo.likedPhotos", "lp", "photo.id = lp.Photo")`
        `->addSelect('lp')`
        `->where('photo.is_public = 1')`
        `->orderBy('photo.uploaded_at', 'DESC')`
        `->getQuery();`

}

Author:jsmarchewka,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69275947/and-in-left-join-with-doctrine
yy