8000 override options recursively · symfony/symfony@cf95089 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf95089

Browse files
committed
override options recursively
1 parent 20485d1 commit cf95089

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/Form/FormFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function createBuilderForProperty($class, $property, $data = null, array
126126

127127
// user options may override guessed options
128128
if ($typeGuess) {
129-
$options = array_merge($typeGuess->getOptions(), $options);
129+
$options = array_replace_recursive($typeGuess->getOptions(), $options);
130130
}
131131

132132
return $this->createNamedBuilder($property, $type, $data, $options);

src/Symfony/Component/Form/Tests/FormFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,15 @@ public function testOptionsCanBeOverridden()
450450
->with('Application\Author', 'firstName')
451451
->will($this->returnValue(new TypeGuess(
452452
'text',
453-
array('attr' => array('maxlength' => 10)),
453+
array('attr' => array('class' => 'foo', 'maxlength' => 10)),
454454
Guess::MEDIUM_CONFIDENCE
455455
)));
456456

457457
$factory = $this->getMockFactory(array('createNamedBuilder'));
458458

459459
$factory->expects($this->once())
460460
->method('createNamedBuilder')
461-
->with('firstName', 'text', null, array('attr' => array('maxlength' => 11)))
461+
->with('firstName', 'text', null, array('attr' => array('class' => 'foo', 'maxlength' => 11)))
462462
->will($this->returnValue('builderInstance'));
463463

464464
$this->builder = $factory->createBuilderForProperty(

0 commit comments

Comments
 (0)
0