diff --git a/UPGRADE-2.5.md b/UPGRADE-2.5.md index 053d5fa1f7..57335a8c7b 100644 --- a/UPGRADE-2.5.md +++ b/UPGRADE-2.5.md @@ -5,3 +5,42 @@ Routing ------- * Added a new optional parameter `$requiredSchemes` to `Symfony\Component\Routing\Generator\UrlGenerator::doGenerate()` + +Form +---- + + * The method `FormInterface::getErrors()` now returns an instance of + `Symfony\Component\Form\FormErrorIterator` instead of an array. This object + is traversable, countable and supports array access. However, you can not + pass it to any of PHP's `array_*` functions anymore. You should use + `iterator_to_array()` in those cases where you did. + + Before: + + ``` + $errors = array_map($callback, $form->getErrors()); + ``` + + After: + + ``` + $errors = array_map($callback, iterator_to_array($form->getErrors())); + ``` + + * The method `FormInterface::getErrors()` now has two additional, optional + parameters. Make sure to add these parameters to the method signatures of + your implementations of that interface. + + Before: + + ``` + public function getErrors() + { + ``` + + After: + + ``` + public function getErrors($deep = false, $flatten = false) + { + ``` diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index aab13e955e..f566ce9852 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -180,6 +180,22 @@ UPGRADE FROM 2.x to 3.0 * The options "csrf_provider" and "intention" were renamed to "csrf_token_generator" and "csrf_token_id". + * The method `Form::getErrorsAsString()` was removed. Use `Form::getErrors()` + instead with the argument `$deep` set to true and cast the returned iterator + to a string (if not done implicitly by PHP). + + Before: + + ``` + echo $form->getErrorsAsString(); + ``` + + After: + + ``` + echo $form->getErrors(true); + ``` + ### FrameworkBundle diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_errors.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_errors.html.php index da9bec42ec..77c60d7dfb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_errors.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_errors.html.php @@ -1,4 +1,4 @@ - + 0): ?>