@@ -55,13 +55,10 @@ By convention they are stored in the ``src/Form/Type/`` directory::
55
55
}
56
56
}
57
57
58
- The ``configureOptions() `` method, which is explained later in this article,
59
- defines the options that can be configured for the form type and sets the
60
- default value of those options.
61
-
62
- The ``getParent() `` method defines which is the form type used as the base of
63
- this type. In this case, the type extends from ``ChoiceType `` to reuse all of
64
- the logic and rendering of that field type.
58
+ The methods of the ``FormTypeInterface `` are explained in detail later in
59
+ this article. Here, ``getParent() `` method defines the base type
60
+ (``ChoiceType ``) and ``configureOptions() `` overrides some of its options.
61
+ The resulting form type is a choice field with predefined choices.
65
62
66
63
.. note ::
67
64
@@ -154,12 +151,16 @@ These are the most important methods that a form type class can define:
154
151
recommended to use instead the ``buildView() `` method.
155
152
156
153
``getParent() ``
157
- It returns a form type class name that is defined as the parent. All
158
- the other form type methods will be called with this parent type, and
159
- all its type extensions, before calling the ones defined in your custom
160
- type.
161
- By default, all classes extend the ``AbstractType `` class, which
162
- defines the ``FormType `` as the parent type.
154
+ If your custom type is based on another type (i.e. they share some
155
+ functionality) add this method to return the fully-qualified class name
156
+ of that original type. Do not use PHP inheritance for this.
157
+ Symfony will call all the form type methods (``buildForm() ``,
158
+ ``buildView() ``, etc.) of the parent type and it will call all its type
159
+ extensions before calling the ones defined in your custom type.
160
+
161
+ By default, the ``AbstractType `` class returns the generic
162
+ :class: `Symfony\\ Component\\ Form\\ Extension\\ Core\\ Type\\ FormType `
163
+ type, which is the root parent for all form types in the Form component.
163
164
164
165
Defining the Form Type
165
166
~~~~~~~~~~~~~~~~~~~~~~
0 commit comments