Just add the aliases of related objects to the select part of your query.
Lets say you have a one-to-many Book associated with Cover , and you want some books to have covers.
With the query builder, use:
->createQueryBuilder() ->select("book, cover") ->from("Book", "book") ->leftJoin("book.covers", "cover")
With the request, use:
SELECT book, cover FROM Book book LEFT JOIN book.covers cover
As a result, you get Book collections with a pre-filled $covers collection.
source share