mongodb-odm
mongodb-odm copied to clipboard
Skip non-mapped typed properties with default values when using Proxies
Q | A |
---|---|
Type | bug |
BC Break | yes |
Fixed issues | #2349 |
Summary
Taking a look at #2349 seems like the problem is that the proxy is not initialized when it's managed.
~Looking at the code, if the document is an instance of GhostObjectInterface
and it not initialized, it calls to $document->setProxyInitializer(null);
which removes the initialization.~
To be honest I'm not sure if it's the right fix, maybe that code was there for some reason.
The test is from https://github.com/andythorne/doctrine-odm-example-error
Update: I was taking a look again to this issue, apparently one way to solve it is to skip those properties when using a proxy.
I was taking a look again at this issue and one possible solution would be to skip these properties.
I've skipped the typed non-mapped properties that have a default value. What about this? maybe is there something else to take into account? 🤔
@malarzm any chance that this might be merged? We are experiencing this issue with Doctrine 2.3 and were hoping to see it solved when we upgrade to 2.4
2.4 is already released. I'll take a look at this after the weekend for inclusion in a 2.5 patch release.
I made some adjustments to the tests to no longer rely on the absence of an error (and instead running an assertion), as well as applying the logic to all unmapped properties, not only those with default values.