V
V
Vasily2014-07-31 16:41:12
symfony
Vasily, 2014-07-31 16:41:12

How to make fields for formbuilder taken from each symfony2 entity?

Again, the question is all about the same symfony2)
Entity can be used in the formbuilder as a choice, but then a select and one data input field are rendered, but how can I make a separate input render for each entry from the database? I think it will be easier to understand with pictures.
This is how it should be,
87b0cfaaa35d499781375b1f9e6962bc.png
Phone 1, phone 2 are taken from the database:

...
$builder
                ->add('phone', 'entity', array(
                               'class' => 'Acme\DemoBundle\Entity\Phone',
                               'property' => 'name'
                          ))
                ->add('note')
                ->add('button', 'submit');
...

00b08fdf0e9d404fbec0f05e44403b95.png
and as a result, a record of the form goes
025179e52f2043e69afd003afe9a3bfd.png
to the database if it is standardly displayed through form_start, then a sad select and one input are displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-07-31
Protko @Fesor

collection .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question