-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
BC Break if the storeEmptyArray is not defined in the mapping #2588
Comments
@frenchcomp we have plenty of tests that are not using the new functionality. Have you regenerated metadata after upgrading ODM? |
Yes all caches, included OPCache, was cleaned and all metadata will be regenerated. |
Nevermind, I already had a potential fix in place. I confirmed the issue and will have a bug fix in a moment. |
I had the default value into the xml but the bug is still here. |
A breakpoint into public function setOwner(object $document, array $mapping) in lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php, the $mapping array has not the key storeEmptyArray |
dump of $mapping in |
Fixed in #2590, will cut a release soon. Thanks @frenchcomp for living on the edge and finding this one! 🥃 |
Great job ! Thanks :) |
BC Break Report
The key 'store-empty-array' in a mapping about a collection is not mandatory with 2.5.5 and lower version, but it is mandatory with 2.6
Summary
We can not upgrade a code using Doctrine ODM 2.5.5 and lower with the new version 2.6, because the mapping option 'store-empty-array' added is mandatory in the CollectionPersister
Previous behavior
The option does not exist
Current behavior
PHP throw a warning for an non existent key : Warning: Undefined array key "storeEmptyArray"
Maybe add a default option in doctrine-mongo-mapping.xsd and in the CollectionPersister, replace line 72
if ($mapping['storeEmptyArray']) {
toif (!empty($mapping['storeEmptyArray'])) {
How to reproduce
Use a collection compliant with 2.5 but not 2.6 like
The text was updated successfully, but these errors were encountered: