symfony/symfony — pull request #3095 by RapotOR (2012-01-11 18:21:54+00:00)
Title: [Form][Doctrine][Bridge] DoctrineType, Add widget property to avoid retrieving the whole ChoiceList

Todo : add some tests

The PR gives a different approach of the PR #1951. Please read the discussion.

The same approach is used for DateType (regarding the widget property).
The entity is retrieved from the the hidden (or another type) field contained in the entitype (which is form and not choice anymore in this case).

How it works?
- If the widget is not `choice`, the `ChoiceList` is not loaded anymore; very useful for a huge table.
- If the `property` is given, a second field is added
- The ID field's type will be the `widget` value (maybe a retriction to hidden or text?) .

The idea is :

$builder->add('city', 'entity', array(
'class' => 'Acme\DemoBundle\Entity\City',
'property' => 'name',
'widget' => 'text',
'required' => false
));

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1951, #1946