Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0.0BETA2
-
Fix Version/s: 1.0.0BETA2
-
Component/s: Hydration, Persister, UnitOfWork
-
Labels:None
-
Environment:Ubuntu 10.04, PHP 5.3.2, Mongo 1.6.3
Description
The setup is a document that has an embedded document. If the embedded document is persisted with at least one field set to null, the changeset for the parent document will include the embedded document, even if no changes have been made.
The reason is that the "$orgValue" in UnitOfWork::computeChangeSet() won't contain the null field at all, while the "$actualValue" contains the field properly set to a null value.
Test coverage and fix to follow.
Tests and fix can be found here: http://github.com/weaverryan/mongodb-odm/tree/invalid_changeset_on_null_properties
Comments on the change welcome. One unrelated test was affected, which required a fix inside BasicDocumentPersister.