-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Form] Add prototype_options to CollectionType #45605
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
|
Hey! I think @HeahDude has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
|
Hello @xabbuh, do you think there is any chance that this gets merged? I would like to close it if there is no chance. Thanks for any answer. |
|
@michaelKaefer This sounds reasonable to me. |
|
@xabbuh Do you mean the PR sounds reasonable or closing the PR sounds reasonable? |
yceruto
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.
Looks good to me, after a minor comment
|
@xabbuh @yceruto Thank you, I added the allowed type definition and created a PR for the docs: symfony/symfony-docs#16664. |
|
Can you please add a test case, and also a line in the changelog of the component? |
|
@nicolas-grekas Sorry, I forgot that, I added both now. |
|
Thank you @michaelKaefer. |
This PR was submitted for the 6.0 branch but it was merged into the 6.1 branch instead. Discussion ---------- [Form] Add new prototype_options Related PR: symfony/symfony#45605 Commits ------- ec76b6a [Form] Add new prototype_options
This PR was merged into the 4.x branch. Discussion ---------- Use CRUD form in CollectionField Implements what `@furang` wrote here: #4766. Needs Symfony 6.1 because it uses `prototype_options` (See symfony/symfony#45605). I createad a reproducer here: https://github.com/michaelKaefer/ea-reproducer/tree/issue/4766-create-update-relations. Without this PR you have to create a form type and set it as entry type for associated entities when using `CollectionField`. This doesn't allow using EA fields and could sometimes kind of duplicates the CRUD form of the associated entity. This new option would enable you to use the CRUD form (if you need different form fields and you cannot reuse the CRUD form you still can implement a custom form type). Related to #3304. Commits ------- 24a99a1 Use CRUD form in CollectionField
Allows defining options for the form for new entries (the prototype form) which differ from the options for the form for existing entries.
My use case: I need this when using EasyAdminBundle. In the form for an entity
PersonI have aCollectionTypefor a related entityBooks. There I can edit theBooksthat aPersonalready has and add newBooks. The change would allow me to show (or disable, etc.) a form field in theBookform only when an existingBookis edited (and not show it when a newBookis added).As far as I can tell it is not a BC break to add this new option. I can provide another PR for the docs if this should get merged.