Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[Form] Created FormErrorBag (Approach 2)#9914

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
wouterj wants to merge3 commits intosymfony:masterfromwouterj:fix_7205_1

Conversation

wouterj
Copy link
Member

From#9099 :

QA
Bug fix?no
New feature?yes
BC breaks?yes
Deprecations?yes
Tests pass?don't know yet...
Fixed tickets#7205
LicenseMIT
Doc PRsymfony/symfony-docs#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 callingFormErrorBag->getAllErrors() aRecursiveArrayIterator is returned, iterating over all errors.

This is fully BC with returning an array and it deprecatesForm::getErrorsAsString()
It's now an IteratorAggregate with ArrayAccess. At normal use, it onlyreturns the root errors. When calling FormErrorBag#getAllErrors() it willreturn a RecursiveArrayIterator, iterating over all form errors.
@wouterjwouterj mentioned this pull requestDec 31, 2013
4 tasks
@stof
Copy link
Member

you need to clone the FormErrorBag when cloning the Form as it is an object now. Otherwise errors will be shared between both forms


// for BC
if (is_array($childrenErrors)) {
$_collection = new FormErrorBag();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we don't use the leading undescore in Symfony

@webmozart
Copy link
Contributor

I thinkadding the errors to the bags is problematic, because now we store the errors in two different locations which we need to synchronize. I found a better and simpler approach using just iterators now that I'm going to post as PR shortly. That approach is somewhat similar to yours, but uses a different perspective (temporary iterators instead of permanent bags).

@webmozart
Copy link
Contributor

replaced by#9918

@wouterjwouterj deleted the fix_7205_1 branchDecember 31, 2013 16:56
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@wouterj@stof@webmozart

[8]ページ先頭

©2009-2025 Movatter.jp