Skip to content

Commit ce1df06

Browse files
committed
[reference] Using the entity alias name instead of fully-qualified name in entity choice - see symfony#683
1 parent 0d05ce8 commit ce1df06

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

reference/forms/types/entity.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The ``entity`` type has just one required option: the entity which should
3838
be listed inside the choice field::
3939

4040
$builder->add('users', 'entity', array(
41-
'class' => 'Acme\\HelloBundle\\Entity\\User',
41+
'class' => 'AcmeHelloBundle:User',
4242
));
4343

4444
In this case, all ``User`` objects will be loaded from the database and rendered
@@ -56,7 +56,7 @@ option. The easiest way to use the option is as follows::
5656
// ...
5757

5858
$builder->add('users', 'entity', array(
59-
'class' => 'Acme\\HelloBundle\\Entity\\User',
59+
'class' => 'AcmeHelloBundle:User',
6060
'query_builder' => function(EntityRepository $er) {
6161
return $er->createQueryBuilder('u')
6262
->orderBy('u.username', 'ASC');
@@ -73,7 +73,9 @@ class
7373

7474
**type**: ``string`` **required**
7575

76-
The class of your entity (e.g. ``Acme\StoreBundle\Entity\Category``).
76+
The class of your entity (e.g. ``AcmeStoreBundle:Category``). This can be
77+
a fully-qualified class name (e.g. ``Acme\StoreBundle\Entity\Category``)
78+
or the short alias name (as shown prior).
7779

7880
property
7981
~~~~~~~~

0 commit comments

Comments
 (0)