[DDC-2178] Last hydrated element is passed by reference Created: 29/Nov/12 Updated: 16/Dec/12 Resolved: 16/Dec/12
|Project:||Doctrine 2 - ORM|
|Reporter:||Menshinskiy Mikhail||Assignee:||Benjamin Eberlei|
$em = $this->getDoctrine()->getEntityManager();
As you can see the last element &array(2) is passed by reference and it broke my code. Can you check this please.
|Comment by Benjamin Eberlei [ 16/Dec/12 ]|
broke your code how? I am afraid this is required by the hydration algorithm and cannot be changed.
|Comment by Menshinskiy Mikhail [ 16/Dec/12 ]|
I think it's unexpected behaviour because NOT ALL but only the LAST element in
I provided an example of issue below.
I used the array $rows fetched above and passed it to the setParameter() like
And now the $rows array contains the following:
Of course I already solved this issue, but I have to remember all the time that the last element in hydrated array is passed by reference.
I understand that it's a part of hydration algorithm, but I think it would be good to pay attention to this behaviour in the documentation to prevent a future problems.
Thanks for your help.