`ORMRepositoryPDO` fetching creates massive queries due to duplicated relation selections
ORMRepositoryPDO::getDomainFetchQuery(...)
iterates relations and for each one calls ORMHelper::getRelationsSelection(...)
, thus adding the selection clause for all the relations on each iteration – so we end up with the relation selection clause in the query X times, where X is the number of relations defined for the domain. This is valid SQL but is an obvious performance issue.
We should call ORMHelper::getRelationSelection(...)
passing $rel
.