Doctrine MongoDB ODM
  1. Doctrine MongoDB ODM
  2. MODM-91

Document unnecessarily persisted when embedded documents have null properties

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major 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.

        Activity

        Hide
        Ryan Weaver added a comment -

        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.

        Show
        Ryan Weaver added a comment - 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.
        Hide
        Jonathan H. Wage added a comment -

        This is fixed now with the latest refactoring of some internal parts.

        Show
        Jonathan H. Wage added a comment - This is fixed now with the latest refactoring of some internal parts.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ryan Weaver
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: