Skip to content

ReferenceMany without targetDocument throws error in ClassMetadataFactory #258

Closed
@leek

Description

@leek

I have a @ReferenceMany defined like this:

    /**
     * @MongoDB\ReferenceMany(mappedBy="post")
     */
    protected $activity;

This works great until I try to serialize the object (using JMSSerializerBundle) as the MongoDB ODM throws the following error:

Warning: class_parents() [function.class-parents]: object or string expected in ...\doctrine-mongodb-odm\lib\Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory.php line 336

Following the stack trace leads me to line 693 of DocumentPersister.php:

        $targetClass = $this->dm->getClassMetadata($mapping['targetDocument']);

$mapping['targetDocument'] in this instance is null.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions