merged branch bschussek/issue4960 (PR #5010)

Commits
-------

eccc5bd [Form] Restored BC in AbstractType::getDefaultOptions() and getAllowedOptionValues()

Discussion
----------

[Form] Restored BC in AbstractType::getDefaultOptions() and getAllowedOptionValues()

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #4960
Todo: -
This commit is contained in:
Fabien Potencier 2012-07-22 09:48:14 +02:00
commit 8cc0cb7610
2 changed files with 8 additions and 6 deletions

View File

@ -52,19 +52,21 @@ abstract class AbstractType implements FormTypeInterface
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults($this->getDefaultOptions());
$resolver->addAllowedValues($this->getAllowedOptionValues());
$resolver->setDefaults($this->getDefaultOptions(array()));
$resolver->addAllowedValues($this->getAllowedOptionValues(array()));
}
/**
* Returns the default options for this type.
*
* @param array $options Unsupported as of Symfony 2.1.
*
* @return array The default options
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
* Use {@link setDefaultOptions()} instead.
*/
public function getDefaultOptions()
public function getDefaultOptions(array $options)
{
return array();
}
@ -72,12 +74,14 @@ abstract class AbstractType implements FormTypeInterface
/**
* Returns the allowed option values for each option (if any).
*
* @param array $options Unsupported as of Symfony 2.1.
*
* @return array The allowed option values
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
* Use {@link setDefaultOptions()} instead.
*/
public function getAllowedOptionValues()
public function getAllowedOptionValues(array $options)
{
return array();
}

View File

@ -106,8 +106,6 @@ CHANGELOG
* removed superfluous methods from DataMapperInterface
* `mapFormToData`
* `mapDataToForm`
* [BC BREAK] FormType::getDefaultOptions() and FormType::getAllowedOptionValues()
don't receive an options array anymore.
* added `setDefaultOptions` to FormTypeInterface and FormTypeExtensionInterface
which accepts an OptionsResolverInterface instance
* deprecated the methods `getDefaultOptions` and `getAllowedOptionValues`