symfony - using sonata_type_collection against a custom form type instead of a property/relationship with another entity -
is possible use sonata_type_collection
against custom form type instead of property/relationship entity?
something this:
$formmapper->add('foo', 'sonata_type_collection', array('type' => new \myvendor\mybundlebundle\form\type\blocktype() ));
which throws me following error
the current field `contingut` not linked admin. please create 1 target entity : ``
edit:
something did trick:
$formmapper->add('contingut', 'collection', array( 'type' => new \myvendor\mybundlebundle\form\type\block1type(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false ));
instead of custom type in example, can use native entity type.
$formmapper->add('cars', 'collection', array( 'type' => 'entity', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, 'label' => false, 'options' => array( 'class' => 'yourbundle:car', 'property' => 'name', 'label' => false ) ) )
Comments
Post a Comment