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] Errors Property Paths mismatch CollectionType children when removing an entry#39438
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
carsonbot commentedDec 10, 2020
Hey! I didn't know that was capable of this emotion. I really really like reviewing this PR. Well done. To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
a435596 todc5e0b2Comparexabbuh commentedJan 12, 2021
@StevioStudio Sorry, your PR somehow slipped through. Thank you for taking the time to create a failing test case. That's really appreciated. 👍 I will try to look into a possible fix soon. |
xabbuh commentedJan 17, 2021
As your test also asserts the entry form types of the collection type are not renamed. So after submitting we only have entry types named With the current implementation I do not see how we can actually fix this as inside the For your project I see two possible workarounds:
|
cristoforocervino commentedJan 17, 2021
Wait, this is not only related to the model I'm using in this unit test. |
xabbuh commentedJan 17, 2021
While I agree I don't see a way to fix this without introducing a new option (like proposed in#7828). So that would go into a future minor version instead of a patch release. By the way, is it really a common use case to use the |
cristoforocervino commentedJan 17, 2021 • 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.
Well, you know that I think the new option with a minor version release could be a good idea. What do you think? |
xabbuh commentedJan 18, 2021
I have a feature like that on my to-do list. Though not sure when I will find the time for it. Hopefully it will make it to 5.3. |
88d307e toa4462c8Comparecristoforocervino commentedJan 18, 2021
I came up with a new |
a4462c8 to2cad8eeComparecristoforocervino commentedApr 13, 2021
This PR initially started as a bug fix with unit test provided to explain the issue. |
andimg93 commentedApr 1, 2022
@xabbuh,@yceruto,@chalasr,@dunglas,@jderusse,@lyrixx,@sroze,@wouterj The real solution must be in the backend, because it is simply a bug and not a feature. |
HeahDude left a comment
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'm not against a new opt-in feature for this but we should be careful when documenting it.
Indeed, such behavior depends on how the collection type data is mapped to the parent object.
In other words, how the adder and remover are implemented in the holder of the collection impact indexes without being able to send feedback to the collection type when going back to the view with errors.
Sadly after discussing this issue with@stof, we cannot think of another way to work around that efficiently, since the PropertyAccess does not allow to set specific indexes when calling adders and removers.
| //In fact, root form should NOT contain errors but it does | ||
| $this->assertCount(1,$form->getErrors(false)); | ||
| //Let's do this again, but with "keep_as_list" option set to true |
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.
Can you create another test method instead of grouping two tests in the same one please?
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 also need a rebase and to update the changelog.
Please tell us if you want to do it or if we should take over, thank you.
94bae4d to70e1b0eCompare70e1b0e tofff25e3Compare
HeahDude left a comment
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 need to make fabbot happy fixing the CS and update the Form component CHANGELOG please. Thanks
fff25e3 tof31de2bComparef31de2b to39587cbComparefabpot commentedDec 9, 2023
Thank you@cristoforocervino. |
Uh oh!
There was an error while loading.Please reload this page.
Description
When you remove an entry from
CollectionTypeand you have errors on children, errors property paths generated byValidatorExtensionare matching final object collection indexes but do not match From children entries index/names.How to reproduce
Unit test provided.
Solution
Introduce new feature with
keep_as_list(booleandefault tofalse) option to reindex children on submit.