merged branch bschussek/issue5428 (PR #6545)
This PR was merged into the 2.1 branch.
Commits
-------
c526ad9
[Form] Fixed inheritance of "error_bubbling" in RepeatedType
Discussion
----------
[Form] Fixed inheritance of "error_bubbling" in RepeatedType
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
This commit is contained in:
commit
14be3e014d
@ -27,6 +27,10 @@ class RepeatedType extends AbstractType
|
|||||||
$options['first_options']['required'] = $options['required'];
|
$options['first_options']['required'] = $options['required'];
|
||||||
$options['second_options']['required'] = $options['required'];
|
$options['second_options']['required'] = $options['required'];
|
||||||
|
|
||||||
|
if (!isset($options['options']['error_bubbling'])) {
|
||||||
|
$options['options']['error_bubbling'] = $options['error_bubbling'];
|
||||||
|
}
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->addViewTransformer(new ValueToDuplicatesTransformer(array(
|
->addViewTransformer(new ValueToDuplicatesTransformer(array(
|
||||||
$options['first_name'],
|
$options['first_name'],
|
||||||
|
@ -72,6 +72,41 @@ class RepeatedTypeTest extends TypeTestCase
|
|||||||
$this->assertFalse($form['second']->isRequired());
|
$this->assertFalse($form['second']->isRequired());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSetErrorBubblingToTrue()
|
||||||
|
{
|
||||||
|
$form = $this->factory->create('repeated', null, array(
|
||||||
|
'error_bubbling' => true,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertTrue($form->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertTrue($form['first']->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetErrorBubblingToFalse()
|
||||||
|
{
|
||||||
|
$form = $this->factory->create('repeated', null, array(
|
||||||
|
'error_bubbling' => false,
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertFalse($form->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertFalse($form['second']->getConfig()->getOption('error_bubbling'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetErrorBubblingIndividually()
|
||||||
|
{
|
||||||
|
$form = $this->factory->create('repeated', null, array(
|
||||||
|
'error_bubbling' => true,
|
||||||
|
'options' => array('error_bubbling' => false),
|
||||||
|
'second_options' => array('error_bubbling' => true),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertTrue($form->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
|
||||||
|
$this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSetOptionsPerChildAndOverwrite()
|
public function testSetOptionsPerChildAndOverwrite()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('repeated', null, array(
|
$form = $this->factory->create('repeated', null, array(
|
||||||
|
Reference in New Issue
Block a user