I'm trying to optimize one of my QueryObjects to not load related entities separately one by one. Usually this is possible using postFetch method. However I've run into a case where the related entities are already loaded when postFetch is called.

After some debugging I found out that the reason is this: https://github.com/…itOfWork.php#…

Which didn't give me any hint as to how to fix this or refactor my entities.

Do you have any tips what can be done in this case?

EDIT: Maybe I should add some info what the relation is about. I have an entity called Demand with ManyToOne relation to Client. Client is abstract with child classes Company and Person.

EDIT2: http://www.doctrine-project.org/…wse/DDC-1600

Solved by selecting clients in the first query instead of trying to optimize it in postFetch.

Note for me in case I run into this again: Another solution might be possible with $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true);.


You must first log in to participate in this discussion