Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Difference between results of getArrayResult() and execute()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gonzo  
View profile  
 More options Sep 22 2012, 8:44 am
From: gonzo <fis...@gmail.com>
Date: Sat, 22 Sep 2012 05:44:37 -0700 (PDT)
Local: Sat, Sep 22 2012 8:44 am
Subject: Difference between results of getArrayResult() and execute()

I have a DQL that is executed multiple times with different parameters.

On the second (and subsequent) run, there is a difference between the
results returned by getArrayResult() and execute() - it seems that there is
some kind of caching in place so that the result of execute is the same
every time (despite the parameters being different).

I have checked that the caching part of AbstractQuery:execute is not
matched
(e.g. https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Ab...)
does not hit.

Can anyone explain?

The code I've used to demonstrate the issue is:

>         foreach($q->getArrayResult() as $group) {

>             foreach($group['properties'] as $property) {

>                 foreach($property['values'] as $value) {

>                     echo $value['id'] . ' ';

>                 }

>             }

>         }

>         echo '<br>';

>>         foreach($q->execute() as $group) {

>             foreach($group->getProperties() as $property) {

>                 foreach($property->getValues() as $value) {

>                     echo $value->getId() . ' ';

>                 }

>             }

>         }

>         echo '<br><br>';

That displays e.g. the following:

> 51 52 137 55

> 51 52 137 55

>> 73 74 141 177 77

> 51 52 137 55

>> 78 79 142 178 82

> 51 52 137 55

>> 83 84 143 179 87

> 51 52 137 55

As you see the second line of each segment remains the same, whereas the
first line (array hydration) is correct.

Thanks in advance :)


 
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.