symfony/symfony — pull request #9914 by WouterJ (2013-12-31 14:11:59+00:00)
Title: [Form] Created FormErrorBag (Approach 2)

From #9099 :

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes
| Deprecations? | yes
| Tests pass? | don't know yet...
| Fixed tickets | #7205
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/issues/3397

The only BC break in this PR is checking it with is_array.

-----

It turns out that the previous approach, using recursive iterators, couldn't work in practise. That's why I introduce, with the help of @igorw, a new approach. When using it normally, it can be accessed as an array and when iterating it will iterate only over the root errors (this is BC). When calling `FormErrorBag->getAllErrors()` a `RecursiveArrayIterator` is returned, iterating over all errors.