diff --git a/book/forms.rst b/book/forms.rst index b7c3750370e..e8286da4cdf 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -390,7 +390,7 @@ you'll need to specify which validation group(s) your form should use:: ; If you're creating :ref:`form classes` (a -good practice), then you'll need to add the following to the ``getDefaultOptions()`` +good practice), then you'll need to add the following to the ``setDefaultOptions()`` method:: use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -1550,7 +1550,7 @@ but here's a short example:: ; Now, when you call `$form->bindRequest($request)`, the constraints setup here are run -against your form's data. If you're using a form class, override the ``getDefaultOptions`` +against your form's data. If you're using a form class, override the ``setDefaultOptions()`` method to specify the option:: namespace Acme\TaskBundle\Form\Type; diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 21ddf251523..d5577af196c 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -70,9 +70,9 @@ important: set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_ for more details. -* ``getDefaultOptions()`` - This defines options for your form type that +* ``setDefaultOptions()`` - This defines options for your form type that can be used in ``buildForm()`` and ``buildView()``. There are a lot of - options common to all fields (see `FieldType`_), but you can create any + options common to all fields (see `FormType`_), but you can create any others that you need here. .. tip:: @@ -80,7 +80,7 @@ important: If you're creating a field that consists of many fields, then be sure to set your "parent" type as ``form`` or something that extends ``form``. Also, if you need to modify the "view" of any of your child types from - your parent type, use the ``buildViewBottomUp()`` method. + your parent type, use the ``finishView()`` method. The ``getName()`` method returns an identifier which should be unique in your application. This is used in various places, such as when customizing diff --git a/cookbook/form/use_virtuals_forms.rst b/cookbook/form/use_virtuals_forms.rst index afc348ebb65..d455e1c1e98 100644 --- a/cookbook/form/use_virtuals_forms.rst +++ b/cookbook/form/use_virtuals_forms.rst @@ -113,7 +113,7 @@ But we absolutely want to have a dedicated form type to deal with location (reme The ``virtual`` form field option is the solution. -We can set the option ``'virtual' => true`` in the ``getDefaultOptions`` method +We can set the option ``'virtual' => true`` in the ``setDefaultOptions()`` method of ``LocationType`` and directly start using it in the two original form types. Look at the result::