-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
DXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)FeatureForm
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 4.0 |
Several times now I saw new inexperienced symfony users getting confused by the Form::getErrors()
method. The problem is the boolean $deep
parameter with a false
default value. Usually it goes like this:
$form->isValid()
returns false. Wait what's wrong?- Oh I will call
$form->getErrors()
to see the problem! - It's empty. If there is no error why is the form not valid?
And here they get stuck for half an hour or more. Of course there is an error but you'll only see it with $form->getErrors(true)
. I confess that this took me a while to figure out as well when I was new to Symfony. Boolean parameters are just evil.
To remove this confusion I suggest to deprecate the getErrors
method in favor of two new methods getAllErrors
and getOwnErrors
. I can send a PR if this change is wanted.
sroze, yceruto, ostrolucky, FabienPapet, mablae and 58 moreitinance, nejgauz, Aka-aka, Kocal, Nispeon and 2 more
Metadata
Metadata
Assignees
Labels
DXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)FeatureForm