doctrine/mongodb-odm — Issue #238: Proxy Not Converted When Loaded Directly
Author: datasage
Created: 2012-01-20 09:07:19+00:00
State: open

Pardon me if I do explain this clearly enough, I am still figuring out some of the details of how all this works.

I have a set of classes which use the discriminator map. This classes have parent and child relationships between them. The parent and child may not have the same sub-classes.

When a child is loaded first, proxies of the relationship objects get put into the identity map. Now it works fine if I load the relationship object via the child object. However, if I then try to load the object direct (findByOne) I get the proxy object instance of an instantiation of one of the sub-classes. Its not converted from a proxy class.

I worked around it for now by detecting the object is a Proxy object in UnitOfWork::getOrCreateDocument and forcing to be loaded as a new object. This is probably not a great fix, but will do for me until the bug is fixed in the project.