Hello,

I have a doubt about the merge functionality. I have posted my findings & 
question also on stackoverflow 
<http://stackoverflow.com/questions/30217110/related-doctrine-proxy-object-does-not-lazy-load-attributes-after-merge-of-paren>,
 
slightly adapted.

I have an entity Child that has a relation to Father (ManyToOne). There is 
no Merge cascade configured.

When I receive an updated Child from a REST API and merge it to update it 
in the database, somewhere on the way the Father relation is lost and it 
seems as if the Child didn't have a Father.

// $child is a json object with child and some attributes of the related 
father
$unmanagedChild = $serializer->deserialize($child, 'MyBundle\Child', 'json'
);
echo $unmanagedChild->getFather()->getName(); // result is John
// at this point i have Child object with a correctly set relation to 
Father with all attributes set from the json
$managedChild = $entityManager->merge($child);
echo $managedChild->getFather()->getName(); // result is empty


So the Entity Manager replaced the Father relation with a Father Proxy 
removing all the attributes. But the proxy doesn't trigger a lazy load 
(query to db) either as I would have expected (i thought that's the core 
purpose of the proxy).

I'm not sure if this is a bug or if I don't understand how the merge() 
method is supposed to work. 

Any hint appreciated!

Thanks & best regards,
Stefan




-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to