Skip to content

[Live] Method Name changes in ComponentWithFormTrait + expanded docs #967

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
Jun 25, 2023

Conversation

weaverryan
Copy link
Member

Q A
Bug fix? no
New feature? yes (the method name changes)
Tickets None
License MIT

Using live components to render a dynamic form is turning out to be a very popular thing to do. The downside is that, in some ways, the form system doesn't "play well" when used so dynamically, which can cause confusion. In this PR:

A) In the docs, I've renamed the property that is bound to your form class to initialFormData to really emphasize that this is the ORIGINAL data used to create the form. It will not represent the new data until the form is submitted. I've also clarified this further in the docs.

B) Updated the docs to talk more about $this->formValues and when data is and isn't updated during the lifecycle.

C) Renamed some methods in ComponentWithFormTrait: getFormInstance() -> getForm() and getForm() -> getFormView(). That's a BC break, and it's going to be annoying... which gives me hesitation. But these are currently named incorrectly (the reason goes back to an old version of live components to help name the variable form in the template).

Cheers!

@weaverryan weaverryan force-pushed the live-tweak-form-docs branch from 8e277ab to 940ec67 Compare June 25, 2023 13:28
@weaverryan weaverryan merged commit 42e87ef into symfony:2.x Jun 25, 2023
bendavies added a commit to bendavies/ux that referenced this pull request Jun 29, 2023
bendavies added a commit to bendavies/ux that referenced this pull request Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant