How can I prevent Doctrine to do an additional request to fill an ArrayCollection?
Suppose there are two entities Foo and Bar
Have Foo have a OneToMany $bars (which itself is ArrayCollection)
At Bar respectively have a ManyToOne $foo.
In the repository using query builder creating a query for a record of Foo.
If the request for Foo is goiny links Bar (and select) and run the where clause, then later when getting through a getter $ArrayCollection bars to get only those records from the Bar that were selected in the query.
If the link from a Bar in the query was not added to the select and/or do not joinlist, then the getter $bars the doctrine itself performs one query to get all links from the Bar and gives them.
Question: how do I prevent her to do this additional query and if the connection has not been selected in the query give an empty array?