In my document I have a field that I want to store the related nodes and I defined it like this:
/**
* @PHPCRODM\ReferenceMany(targetDocument="Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page", strategy="hard")
*/
protected $related_guides;
I added the related nodes using the document manager and I can see them and created links in my twig file. The problem that I have is allowing the admin to add or delete the related nodes in the sonata admin.
When I used ORM I used 'sonata_type_collection' but it seems it doesn't work in ODM. I got this error:
INVALID MODE : s537a4d1c263c0_related_guides - type : sonata_type_collection - mapping : 8
sonata_type_model_list only works for ReferenceOne relations and for ReferenceMany I got this error:
The class 'Doctrine\ODM\PHPCR\ReferenceManyCollection' was not found in the chain configured namespaces Doctrine\ODM\PHPCR\Document, Sandbox\MainBundle\Document, Vectorworks\Bundle\CmsBundle\Document, Symfony\Component\Routing, Symfony\Cmf\Bundle\RoutingBundle\Model, Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\MenuBundle\Model, Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\ContentBundle\Model, Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\BlockBundle\Model, Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\SeoBundle\Model, Symfony\Cmf\Bundle\SeoBundle\Doctrine\Phpcr, Symfony\Cmf\Bundle\MediaBundle\Doctrine\Phpcr
Is there any way to get this functionality out of Sonata Admin? BTW my fields is the type of Doctrine\ODM\PHPCR\ReferenceManyCollection to support the @ReferenceMany relation.