-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class #3819
8000 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
Conversation
Again, the failing build is not my fault. |
@@ -11,10 +11,13 @@ | |||
|
|||
namespace Symfony\Component\Form\Extension\Core\DataMapper; | |||
|
|||
use Traversable; |
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 never used in this file.
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.
Fixed
…h class Setting a property path like "article.tags" will now automatically try to favor addTag() and removeTag() over setTags(), if found. If you want to set up a property path with an irregular singular that is not detected, you can use "|" to separate the plural from the singular form in the path: "article.genera|genus". Another consequence of this commit is that the MergeCollectionListener has been simplified a lot. Forms returning an array or a collection will always result in adders/removers being called now without having to add this listener.
Commits ------- c4e68a3 [Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class Discussion ---------- [Form] Moved logic of addXxx()/removeXxx() methods to the PropertyPath class Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: #3732 Todo: -  The addXxx()/removeXxx() methods should now be called correctly in ChoiceType and CollectionType. PropertyPath now favors addXxx()/removeXxx() over setXxx() for collections. For example: ``` $propertyPath = new PropertyPath('article.tags'); // Tries to use addTag()/removeTag() and only uses setTags() (et al.) // if not found $propertyPath->setValue($article, $tags); ``` For other languages than English or very irregular plurals, a custom singular can be set by separating it with a pipe: ``` $propertyPath = new PropertyPath('article.genera|genus'); ``` --------------------------------------------------------------------------- by bschussek at 2012-04-07T12:40:39Z Again, the failing build is not my fault.
As mentioned by @stof the functionality has been reverted and it is currently not possible to use another name than guessed by symfony. |
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3732
Todo: -
The addXxx()/removeXxx() methods should now be called correctly in ChoiceType and CollectionType.
PropertyPath now favors addXxx()/removeXxx() over setXxx() for collections. For example:
For other languages than English or very irregular plurals, a custom singular can be set by separating it with a pipe: