[DDC-2178] Last hydrated element is passed by reference Created: 29/Nov/12 Updated: 16/Dec/12 Resolved: 16/Dec/12 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.3 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Menshinskiy Mikhail | Assignee: | Benjamin Eberlei |
| Resolution: | Can't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Test script: $em = $this->getDoctrine()->getEntityManager(); Output: array(3) { [1]=> [2]=> } As you can see the last element &array(2) is passed by reference and it broke my code. Can you check this please. |
| Comments |
| 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 $this->getDoctrine()->getRepository('FMECoreBundle:Admin') And now the $rows array contains the following: array(3) { [1]=> [2]=> 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. |