When using Entity we can load choices from Entity via form field type entity
$builder->add('group', 'entity', array(
'class' => 'Fist\CoreBundle\Document\Group',
));
but when using mongodb document what is the best way to inject select options from Document?
in my case load all Groups from Group document. Is there better way to do that than passing to form constructor?
Thank you all
I had to partially stray from Dylan Oliver's answer.
could not be found, as of November 2016 DocumentType seems to reside here:
Change
entity
todocument
, and you can just use the shortcut. ex:FistCoreBundle:Group
The Doctrine MongoDB ODM equivalent of
EntityType
isSymfony\Bundle\DoctrineMongoDBBundle\Form\Type\DocumentType
.DocumentChoiceList
,DocumentsToArrayTransformer
, andDocumentToIdTransformer
are also included in DoctrineMongoDBBundle and parallel their ORM equivalents.