10000 [Form] Merged FieldType into FormType by webmozart · Pull Request #3923 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Merged FieldType into FormType #3923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 18, 2012
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Form] Fixed regression: bind(null) was not converted to an empty str…
…ing anymore
  • Loading branch information
webmozart committed Apr 17, 2012
commit 6e4ed9e177fc6c9bf54bac9f0333457d222185fa
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/Extension/Core/Type/FormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ public function getDefaultOptions()
if ($form->hasChildren()) {
return array();
}
};

return '';
return '';
};
};

return array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,22 @@ public function testBindWithEmptyDataStoresArrayIfNoClassAvailable()
$this->assertSame(array('firstName' => 'Bernhard'), $form->getData());
}

public function testBindWithEmptyDataPassesEmptyStringToTransformerIfNoChildren()
{
$form = $this->factory->createBuilder('form')
->appendClientTransformer(new FixedDataTransformer(array(
// required for the initial, internal setData(null)
null => 'null',
// required to test that bind(null) is converted to ''
'empty' => '',
)))
->getForm();

$form->bind(null);

$this->assertSame('empty', $form->getData());
}

public function testBindWithEmptyDataUsesEmptyDataOption()
{
$author = new Author();
Expand Down
0