-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken ODM schema produces different results with and without schema caching #1271
Comments
I suppose this could happen because of checks like this one - when metadata is built we're not strict and will set everything passed while for serialization we'll require certain conditions to be met to dump related properties.
If I'm not mistaken you could gather all metadata and check if |
Could you put me on the track how to do it? Im not familiar with the core fuctions, and its quite complex. |
Take a look at mongodb-odm/lib/Doctrine/ODM/MongoDB/Tools/Console/Command/GenerateProxiesCommand.php Line 69 in cb327d1
$original == unserialize(serialize($original)) - that should be all.
|
Thanks for pointing me to the right direction. Here is the testing snippet:
I chose If some needs more info about the diff this tool could be used https://github.com/sebastianbergmann/diff. Thank you! I owe you a beer :) |
Looking forward ;) Also if somebody would have time to pull this together as a command it would be cool. |
Closing as #1519 was merged |
On dev enviroment we don't use MetadataCache, but in production we do.
The problem is that the schema genereated from yaml files seems to be okay in dev, but fails on production.
The first request is okay when there is no cache yet, but when the schema is read from cache sometimes there are errors that are not experienced without caching.
By saying "using no cache" I mean either setting ArrayCache, or setting other caching methods like Filesystem cache or Mongodb cache but clearing all entries before running the script.
In the example below you can see a schema with inheritance, with some lines commented out.
I know that they are invalid without the commented lines, but it works when caching is not enabled.
When retrieving documents from DB without cache (even if I caching is on but empty), I get the correct hydrated objects, but when using caching, ODM tries to hydrate the document as Document\Font\Family (the superclass)
It is absolutely clear that the problem is with the missing attrbutes (inheritanceType, type: mappedSuperclass), but the sad thing is that we encounter the problem on production env only.
Is there a way that we validate the schema with a cli tool, or to make the caching system so that ODM produces the same results with and without caching (even if the schema is invalid)?
The text was updated successfully, but these errors were encountered: