On an example: There is a table "Films" and "Genres", connected by many-to-many. It is necessary to deduce all the Genres of the Film if at least one Genre coincides with the condition. That is, films are selected by Genre, but for each film it is necessary to show not only the Genre that coincided with the condition, but everything related to it.
All this in Doctrine2 Query Builder.
Upd. Request at the moment in the form of DQL:
SELECT Movies, Movies, MovieGenres FROM Entities\Movies Movies LEFT JOIN Movies.MovieGenres MovieGenres WITH MovieGenres.id IN (:genres) WHERE Movies.id IN (SELECT MovieGenres2.id FROM Entities\MovieGenres MoviesGenres2) GROUP BY Movies, MovieGenres In this form, the film with the genres "Western", "Drama" when searching for the word "Western" only the genre "Western", and "Drama" shows if it is also looking for it.