From: "Jasper N. Brouwer" <jas...@nerdsweide.nl>
Date: Thu, 27 Sep 2012 14:12:14 +0200
Local: Thurs, Sep 27 2012 8:12 am
Subject: Re: [doctrine-user] Incremental hydration for fetch-joined entities
One option that comes to mind is to have "the first" query only fetch ids of the root entity. You can loop over the array of ids and perform the fetch-join query you need to fully load that entity (with all associations).
I know this will still perform N + 1 queries (where N is the amount of ids), but it's better than N * A + 1 queries (where A is the amount of associations you need to load). -- On 27-09-2012, at 13:59, acid24 <aci...@gmail.com> wrote:
> Hi,
> I am aware of the note from the manual that says "Iterating results is not possible with queries that fetch-join a collection-valued association. The nature of such SQL result sets is not suitable for incremental hydration.". But is there a work-around for this? I need to retrieve a set of fetch-joined entities and I really would like to hydrate them one by one instead of loading the all the entities in memory. The obvious alternative is to load each association of each entity (and the associations' associations) manually (by accessing them), but this will trigger way too much queries. I should mention that retrieving the result set as arrays doesn't help me, what I need are the entities (and their loaded associations). You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||