【发布时间】:2021-09-21 21:54:24
【问题描述】:
如何像这样在 LEFT JOIN 中添加 AND SELECT * FROM photo LEFT JOIN like_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();`
}
【问题讨论】:
-
在 lp 表上使用 WHERE user_id = 6 后我需要离开联接
标签: doctrine-orm doctrine