@@ -546,34 +546,24 @@ types such as strings, integers and fields. However you can also integrate
546546them nicely with associations.
547547
548548This is done by the help of a dedicated field:
549- :class: `Symfony\\ Component \ \ Form\\ EntityChoiceField `. It provides a list of
549+ :class: `Symfony\\ Brigde \D octrine \F orm\T ype \E ntityType `. It provides a list of
550550choices from which an entity can be selected.
551551
552552.. code-block :: php
553553
554554 use Symfony\Component\Form\EntityChoiceField;
555555
556- $field = new EntityChoiceField('users', array(
557- 'em' => $em,
558- 'class' => 'Acme\\HelloBundle\\Entity\\User',
559- 'property' => 'username',
560- 'query_builder' => $qb,
556+ $builder->add('users','entity',
557+ array('class' => 'Acme\\HelloBundle\\Entity\\User',
561558 ));
562559
563- $form->addField($field);
564-
565- The 'em' option expects the EntityManager, the 'class' option expects the Entity
566- class name as an argument. The optional 'property' option allows you to choose
567- the property used to display the entity (``__toString `` will be used if not
568- set). The optional 'query_builder' option expects a ``QueryBuilder `` instance or
560+ The required 'class' option expects the Entity class name as an argument.
561+ The optional 'property' option allows you to choose the property used to
562+ display the entity (``__toString `` will be used if not set).
563+ The optional 'query_builder' option expects a ``QueryBuilder `` instance or
569564a closure receiving the repository as an argument and returning the QueryBuilder
570565used to get the choices. If not set all entities will be used.
571566
572- .. tip ::
573-
574- ``EntityChoiceField `` extends :class: `Symfony\\ Component\\ Form\\ ChoiceField `
575- so you can also give the array of choices with the 'choices' option instead
576- of using a QueryBuilder.
577567
578568.. _documentation : http://www.doctrine-project.org/docs/orm/2.0/en
579569.. _Doctrine : http://www.doctrine-project.org
0 commit comments