Skip to content

[Form] Explain how to actually reuse the same form #13977

@ThomasLandauer

Description

@ThomasLandauer

https://symfony.com/doc/current/forms.html#creating-form-classes says:

Besides, forms defined in classes can be reused in multiple actions and services.

But how? What is the best practice here?

  • Set up an own controller for the form, then do {{ render(controller('App\\Controller\\...)) }} in Twig
  • Or create the form in each controller ($this->createForm(...);), and then (maybe) set its action to some central form processing controller?

I think there should be a dedicated page about this: What are the relevant questions you need to ask yourself before choosing the approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions