Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Add ability to clear form errors#27571
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Update to latest symfony master
colinodell commentedJun 10, 2018
Thank you for re-creating and re-submitting my old commit! 👍 |
| * | ||
| * @return FormInterface The form instance | ||
| */ | ||
| publicfunctionclearErrors($deep =false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think this will be possible. You'll have to make this work for 4.x as well and as is, it's a BC break. Probably requires a new interface, which can be merged in this interface in 5.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do you mean I should create something likeFormClearErrorsInterface and makeForm implement that?
If we want to merge it intoFormInterface in 5.0, does that mean theFormClearErrorsInterface should be marked as deprecated right away, so that people will be aware that it goes away in version 5.0?
I have not done something like this before, so that is why I would apreciate some guideance in how to do it. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Also@dosten wrote in#14233 (comment) that the BC break would not be a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Also@dosten wrote in#14233 (comment) that the BC break would not be a problem.
The BC promise states that adding a new method is not acceptablehttp://symfony.com/doc/current/contributing/code/bc.html#changing-interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@TerjeBr The comment you linked dates from 2015, since then the concept of@api interface was removed and we now consider every class as part of the public API (#15977,symfony/symfony-docs#5735). This means we can't add methods to any interface.
TerjeBr commentedJun 11, 2018
Please correct me if I am misstaken, but is the Is this interfece not more kind of "internal" to the Symfony framework? |
pierredup commentedJun 11, 2018
Only if an interface is marked as |
TerjeBr commentedJun 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am trying to find a way forward here. Is it reasonable to want to mark |
TerjeBr commentedJun 11, 2018
Or if I do as@iltar suggested, add a new interface, should that interface be created with the tag |
javiereguiluz commentedJun 19, 2018
Let's ping our Symfony Form expert@vudaltsov to see if he can spot any issue here (besides the interface issue mentioned by Iltar). |
vudaltsov commentedJun 19, 2018
This PR can be closed in favor of#27580. |
| * deprecated the`ChoiceLoaderInterface` implementation in`CountryType`,`LanguageType`,`LocaleType` and`CurrencyType` | ||
| * added`input=datetime_immutable` to DateType, TimeType, DateTimeType | ||
| * added`rounding_mode` option to MoneyType | ||
| * added`FormInterface::clearErrors()` method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
we cannot do this in a minor release as it is a BC break
| * | ||
| * @return FormInterface The form instance | ||
| */ | ||
| publicfunctionclearErrors($deep =false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is a BC break that needs to be reverted.
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| publicfunctionclearErrors($deep =false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
public function clearErrors(bool $deep = false): void
xabbuh commentedJun 19, 2018
This PR was squashed before being merged into the 4.2-dev branch (closes#27580).Discussion----------[Form] Add ability to clear form errors| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#14060| License | MIT| Doc PR |symfony/symfony-docs#9916This PR adds the ability to manually clear form errors, thus improving the DX issue reported in#14060.Unlike my original approach in#14233 and#27571 which break BC, this adds a new `ClearableErrorInterface` which `Form` implements. (`Button` does not implement it because buttons can't have errors.)Commits-------9eb755c [Form] Add ability to clear form errors
Uh oh!
There was an error while loading.Please reload this page.
This PR adds the ability to manually clear form errors, thus improving the DX issue reported in#14060.
This is a copy of PR#14233