Search code examples
zend-framework2doctrine-odm

Mongo ODM not hydrating referenced object


I am experiencing an issue here with MongoDB ODM with Doctrine: I have a form which has a fieldset say 'A'. That fieldset 'A' also has another fieldset say 'B' which contains a select element that is being populated via the DoctrineModule's selectObject.

According to advised principles, every model/document should have its own fieldset, fieldset A has a document 'DA' and fieldset 'B' a document 'DB'. There is also a ReferenceOne relationship between DA and DB .i.e. DA has a property that references one DB, now this is the problem.

When i submit the form, I get a badMethodCallException.

Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::getAssociationTargetClass($assocName) is not implemented yet.

which is obvious.

Let me say that I am using the DoctrineHydrator in the form and fieldsets,like this

$this->setHydrator(new \DoctrineModule\Stdlib\Hydrator\DoctrineObject($documentManager));

followed by (in the filedsets alone)

$this->setObject($document);

Let me say that am new to this so i need to ask what can be done?


Solution

  • All that was needed was to get the latest version of doctrine's mongodb-odm Thanks