Skip to content

[Form] Add new prototype_options #16664

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

Merged
merged 1 commit into from
Apr 4, 2022
Merged

Conversation

michaelKaefer
Copy link
Contributor

Related PR: symfony/symfony#45605

@michaelKaefer
Copy link
Contributor Author

Sorry, this is not finished yet.

@xabbuh xabbuh added the Waiting Code Merge Docs for features pending to be merged label Apr 1, 2022
@carsonbot carsonbot added this to the next milestone Apr 1, 2022
@michaelKaefer
Copy link
Contributor Author

From my side this is finished now. But it still waits for code merge.

nicolas-grekas added a commit to symfony/symfony that referenced this pull request Apr 3, 2022
…lKaefer)

This PR was merged into the 6.1 branch.

Discussion
----------

[Form] Add prototype_options to CollectionType

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#16664

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 `Person` I have a `CollectionType` for a related entity `Books`. There I can edit the `Books` that a `Person` already has and add new `Books`. The change would allow me to show (or disable, etc.) a form field in the `Book` form only when an existing `Book` is edited (and not show it when a new `Book` is 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.

Commits
-------

b1d40c1 [Form] Add prototype_options to CollectionType
symfony-splitter pushed a commit to symfony/form that referenced this pull request Apr 3, 2022
…lKaefer)

This PR was merged into the 6.1 branch.

Discussion
----------

[Form] Add prototype_options to CollectionType

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | symfony/symfony-docs#16664

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 `Person` I have a `CollectionType` for a related entity `Books`. There I can edit the `Books` that a `Person` already has and add new `Books`. The change would allow me to show (or disable, etc.) a form field in the `Book` form only when an existing `Book` is edited (and not show it when a new `Book` is 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.

Commits
-------

b1d40c16be [Form] Add prototype_options to CollectionType
@michaelKaefer
Copy link
Contributor Author

The code was merged now, so this could also be reviewed/merged.

@javiereguiluz javiereguiluz removed the Waiting Code Merge Docs for features pending to be merged label Apr 4, 2022
@javiereguiluz javiereguiluz modified the milestones: next, 6.1 Apr 4, 2022
@javiereguiluz javiereguiluz changed the base branch from 6.0 to 6.1 April 4, 2022 06:48
@javiereguiluz javiereguiluz merged commit 629ec50 into symfony:6.1 Apr 4, 2022
@javiereguiluz
Copy link
Member

Michael, thanks a lot for implementing this feature and providing its docs! We've merged this into 6.1 (minor comment: we added the missing .. versionadded:: 6.1 directive while merging). Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants