Skip to content

[Form] Explaining how to inject the form factory #16364

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
Sep 22, 2022
Merged
Changes from all commits
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
7 changes: 2 additions & 5 deletions components/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,6 @@ you need to. If your application uses global or static variables (not usually a
good idea), then you can store the object on some static class or do something
similar.

Regardless of how you architect your application, remember that you
should only have one form factory and that you'll need to be able to access
it throughout your application.

.. _component-form-intro-create-simple-form:

Creating a simple Form
Expand All @@ -382,7 +378,8 @@ Creating a simple Form
.. tip::

If you're using the Symfony Framework, then the form factory is available
automatically as a service called ``form.factory``. Also, the default
automatically as a service called ``form.factory``, you can inject it as
``Symfony\Component\Form\FormFactoryInterface``. Also, the default
base controller class has a :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::createFormBuilder`
method, which is a shortcut to fetch the form factory and call ``createBuilder()``
on it.
Expand Down