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

Storing embeded documents containing embeded documents, already persistet in another collection fails

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0.0BETA3
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      We persist a document a1 containing an embedded document a1.1 which itself contains another embedded document a1.1.1. When the embedded document a1.1 is moved to another document of another collection b1 and needs to get persisted as embedded document b1.1 the embedded document a1.1.1 (which is now part of b1.1, too) is not saved as an embedded document of b1.1.

      Example: We use a version object which contains a pageversion as an embedded document. This page object contains multiple elements (stored as embedded documents) which themselves contain several parameter objects (stored as embedded document of elements). Now assume we have such a persisted version and want to "copy" the pageversion in another collection. So we generate a new page object, and add to this page all elements of the persisted pageversion. If we now persist this page, the representation in mongodb contains all elements but not any parameters, which should be part of the page as well (as they are part of an element).

        Activity

        Kolja Treutlein created issue -
        Hide
        Kolja Treutlein added a comment -

        Testcase

        Show
        Kolja Treutlein added a comment - Testcase
        Kolja Treutlein made changes -
        Field Original Value New Value
        Attachment testcase.tar.gz [ 10945 ]
        Hide
        Jonathan H. Wage added a comment -

        Try cloning the embedded document when you move it. The reason why you have issues most likely is because internally inside Doctrine we keep track of each embedded document instance and what parent document it is attached to. So when you move it, Doctrine gets confused. You need to move it by cloning so the embedded document is actually a new object instance to Doctrine.

        Show
        Jonathan H. Wage added a comment - Try cloning the embedded document when you move it. The reason why you have issues most likely is because internally inside Doctrine we keep track of each embedded document instance and what parent document it is attached to. So when you move it, Doctrine gets confused. You need to move it by cloning so the embedded document is actually a new object instance to Doctrine.

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=MODM-129, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated: