-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.1][Form] CollectionType / PropertyPath BC Break? #4158
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The question is how PropertyPath should behave in that case? If we remove the exception and change it to use |
That's the case, where/why I would suggest to add an option that's false by default; allowing one to force the usage of the setter, despite the fact there is only one (or even both) of the add and remove methods. |
btw, shouldn't the |
It used to be; as far as I can see this is not passed to the |
@stof: Not anymore. Handling of add/remove has been moved into the
The field maps to a collection. There are three possible approaches for modifying this collection:
The question is how PropertyPath distinguishes between 2 and 3. Any solution to this problem necessarily introduces a new syntax that enforces usage of a setter/adder, for example
The problem is that we already introduced a special syntax for configuring custom singulars, which is
We must take care now not to introduce anything that will hurt us in the future, for example, by limiting the set of allowed property names. |
@bschussek @havvg I have a PR for Propel waiting to add remove method, but with that I got an issue with the property path : The remove method work only for the first element, because when remove is called, the collection is modified and the foreach break. <?php
$previousValue = is_object($previousValue)? clone $previousValue : $previousValue; |
@jaugustin Could you please open a separate ticket for this? I'll look at this. |
sure |
Closing this old issue. |
The
Symfony\Component\Form\Util\PropertyPath
has changes in its behavior.My question is; whether this is intended and if so should be noted as a BC break, or whether the given object should be considered valid (maybe adding an option to force the use of the setter method):
Before
An object having the methods
addOccupation
andsetOccupations
(Propel model) worked by usingsetOccupations
.After
The same object is now broken, the
PropertyPath::writeProperty
throws an Exception due to the missingremoveOccupation
method. However, thesetOccupations
is still there, but not used anymore.The text was updated successfully, but these errors were encountered: