Skip to content

#6232 update forms as services section #6235

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions best_practices/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ Registering Forms as Services

You can also
:ref:`register your form type as a service <form-cookbook-form-field-service>`.
But this is *not* recommended unless you plan to reuse the new form type in many
places or embed it in other forms directly or via the
:doc:`CollectionType </reference/forms/types/collection>`.

For most forms that are used only to edit or create something, registering
the form as a service is over-kill, and makes it more difficult to figure
out exactly which form class is being used in a controller.
This is only needed if your form type requires some dependencies to be injected
by the container, otherwise it is just unnecessary overhead and therefore
*not* recommended to do this for each and every form type class.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very minor thing is that for some reason, people hate reading docs. So I think we can improve this sentence a little bit by removing some not-needed words like replacing "just unnecessary overhead" with "unnecessary overhead" and "each and every form type class" with "for all form type classes".

If you want to apply these changes, you can navigate to your fork ( https://github.com./backbone87/symfony-docs ), select the branch of this PR (patch-1) and edit the file. If you, for any reason, do not want to do it, we will apply these changes while merging the PR.


Form Button Configuration
-------------------------
Expand Down