Skip to content
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

[LiveComponent] Dependent Form Fields documentation #1099

Closed
wants to merge 3 commits into from

Conversation

smbpunt
Copy link

@smbpunt smbpunt commented Sep 6, 2023

Q A
Bug fix? no
New feature? no
License MIT

Hi,

I followed the documentation and I had trouble using the same form when editing my object.

Since the third attributes $data of createNamedBuilder() is @param mixed $data The initial data,
should we not give him a Food instead of meal ?
Check my PR.


In order to handle edition using the same form, I also edited the LiveComponent.
With this, to call the component we need to pass attributes (but it's not on this page of the documentation).

{{ component('MealPlanner', {
    form: form,
    mealPlan: mealPlan.id ? mealPlan : null,
}) }}

Imho, this might be a good idea to add it to the documentation too (I found mealPlan: mealPlan.id ? mealPlan : null in an issue...)

Thanks

@weaverryan
Copy link
Member

Hi there!

Apologies for the slow reply on your PR :). Actually, it's a nice change - but I had, by coincidence, just 1 day after this PR, refactored that class to use symfonycasts/dynamic-forms. Hopefully I've not introduced any new mistakes in that PR ;).

Thanks!

@weaverryan weaverryan closed this Sep 22, 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.

2 participants