@@ -39,7 +39,7 @@ Services & Configuration
3939
4040If you want to modify service definitions of another bundle, you can use a compiler
4141pass to change the class of the service or to modify method calls. In the following
42- example, the implementing class for the ``original-service-id `` is changed to
42+ example, the implementing class for the ``original-service-id `` is changed to
4343``Acme\DemoBundle\YourService ``::
4444
4545 // src/Acme/DemoBundle/DependencyInjection/Compiler/OverrideServiceCompilerPass.php
@@ -72,17 +72,16 @@ associations. Learn more about this feature and its limitations in
7272Forms
7373-----
7474
75- In order to override a form type, it has to be registered as a service (meaning
76- it is tagged as ``form.type ``). You can then override it as you would override any
77- service as explained in `Services & Configuration `_. This, of course, will only
78- work if the type is referred to by its alias rather than being instantiated,
79- e.g.::
75+ Form types are referred to by their fully-qualified class name::
8076
81- $builder->add('name', 'custom_type' );
77+ $builder->add('name', CustomType::class );
8278
83- rather than::
79+ This means that you cannot override this by creating a sub-class of ``CustomType ``
80+ and registering it as a service and tagging it with ``form.type `` (you *could *
81+ do this in an earlier version).
8482
85- $builder->add('name', new CustomType());
83+ Instead, you should use a "form type extension" to modify the existing form type.
84+ For more information, see :doc: `/form/create_form_type_extension `.
8685
8786.. _override-validation :
8887
@@ -93,7 +92,7 @@ Symfony loads all validation configuration files from every bundle and
9392combines them into one validation metadata tree. This means you are able to
9493add new constraints to a property, but you cannot override them.
9594
96- To override this, the 3rd party bundle needs to have configuration for
95+ To overcome this, the 3rd party bundle needs to have configuration for
9796:doc: `validation groups </validation/groups >`. For instance, the FOSUserBundle
9897has this configuration. To create your own validation, add the constraints
9998to a new validation group:
0 commit comments