I have two entities in Doctrine: oneToMany between Post and Comments. Comments are owned by a User. I want to retrieve all posts and comments for which at least one comment is owned by a certain user. What would be the proper way of achieving that with Doctrine's Query Builder?
$em->createQueryBuilder('p')
->innerJoin('p.comments','c')
->having(AT LEAST ON c.user = :user)
->where(p.id = :idPost)
Could you help me folks ?