Skip to content

References to embedded document collections #554

Open
@Bilge

Description

@Bilge

I'm not sure if this is officially supported by Doctrine, since it is not documented, but it works - with an error notice.

For example, if I have documents A and B where document B has an embedded document, E, I can design the mapping as follows:

/** @Document */
class A {
    /** @ReferenceMany(targetDocument="B", mappedBy="foo.bar") */
    private $whatever = [];
}

/** @Document */
class B {
    /** @EmbedMany(targetDocument="E") */
    private $foo = [];
}

/** @EmbeddedDocument */
class E {
     /** @ReferenceOne(targetDocument="A", inversedBy="whatever") */
    private $bar;
}

However, reading A::$whatever generates the following notice:

Notice: Undefined index: foo.bar in mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php on line 709

Despite this, the document collection is retrieved correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions