Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Form] Remove choice or choice_list requirement as the following cond…
…itions already check enough and this condition prevents empty select forms (populated by ajax for example)
  • Loading branch information
beberlei committed Jul 5, 2011
1 parent 8a1fe40 commit 431460f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php 100644 → 100755
Expand Up @@ -31,10 +31,6 @@ class ChoiceType extends AbstractType
*/
public function buildForm(FormBuilder $builder, array $options)
{
if (!$options['choices'] && !$options['choice_list']) {
throw new FormException('Either the option "choices" or "choice_list" is required');
}

if ($options['choice_list'] && !$options['choice_list'] instanceof ChoiceListInterface) {
throw new FormException('The "choice_list" must be an instance of "Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface".');
}
Expand Down
8 changes: 0 additions & 8 deletions tests/Symfony/Tests/Component/Form/Extension/Core/Type/ChoiceTypeTest.php 100644 → 100755
Expand Up @@ -303,14 +303,6 @@ public function testSetDataMultipleNonExpandedAcceptsBoolean()
$this->assertEquals(array('0', '1'), $form->getClientData());
}

/**
* @expectedException Symfony\Component\Form\Exception\FormException
*/
public function testRequiresChoicesOrChoiceListOption()
{
$this->factory->create('choice', 'name');
}

public function testPassRequiredToView()
{
$form = $this->factory->create('choice', null, array(
Expand Down

0 comments on commit 431460f

Please sign in to comment.