Details
Description
When dealing with parent / children entities, the UnitOfWork does not always hydrate all data correctly.
This example generates Group1 and its child Group2. Then Clears the Entity Manager, loads Group2 (so it is in the EM), loads Group1 and then the children of Group1 (Group2 is the child of Group1).
However the children of Group1 cannot be loaded, because $group4->children is not there:
Warning: Invalid argument supplied for foreach() in /Users/nico/Projects/test/test.php on line 20
When calling Debug::dump($group4), I get this:
object(stdClass)#56 (2) {
["__CLASS__"]=>
string(26) "Proxies\EntitiesGroupProxy"
["id"]=>
string(1) "1"
}
test.php
http://pastebin.com/7Q3wwtn6
Group entity:
http://pastebin.com/hBj2Emrf
If I clear the Entity Manager between lines 17 and 18, it works... Seems like the previously loaded Group is reused (which is perfectly fine), but its associations (or at least its self-referenced associations) are not loaded (neither proxies are generated)...