Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf95089

Browse filesBrowse files
committed
override options recursively
1 parent 20485d1 commit cf95089
Copy full SHA for cf95089

File tree

Expand file treeCollapse file tree

2 files changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-3
lines changed

‎src/Symfony/Component/Form/FormFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/FormFactory.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/FormFactoryTest.php
+2-2Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.