Skip to content

Commit 75e7a9a

Browse files
committed
minor #7490 Minor fixes about bundle overridding (franciscocorrales, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Minor fixes about bundle overridding This finishes #6985. Commits ------- c9a52ae Added the changes suggested by reviewers d5cd8d0 Reworded the section about form overridding 600d302 Update installation.rst 62bfc21 Update prepend_extension.rst 2f837d6 Update override.rst 3433e50 Update installation.rst f684bdd Update inheritance.rst
2 parents 15d0cc2 + c9a52ae commit 75e7a9a

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

bundles/inheritance.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ The same goes for routing files and some other resources.
9393

9494
The overriding of resources only works when you refer to resources with
9595
the ``@FOSUserBundle/Resources/config/routing/security.xml`` method.
96-
If you refer to resources without using the ``@BundleName`` shortcut, they
97-
can't be overridden in this way.
96+
You need to use the ``@BundleName`` shortcut when refering to resources
97+
so they can be successfully overridden (except templates, which are
98+
overridden in a different way, as explained in :doc:`/templating/overriding`).
9899

99100
.. caution::
100101

bundles/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ version, include it as the second argument of the `composer require`_ command:
4848
B) Enable the Bundle
4949
--------------------
5050

51-
At this point, the bundle is installed in your Symfony project (in
51+
At this point, the bundle is installed in your Symfony project (e.g.
5252
``vendor/friendsofsymfony/``) and the autoloader recognizes its classes.
5353
The only thing you need to do now is register the bundle in ``AppKernel``::
5454

bundles/override.rst

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Services & Configuration
3939

4040
If you want to modify service definitions of another bundle, you can use a compiler
4141
pass 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,8 @@ associations. Learn more about this feature and its limitations in
7272
Forms
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.::
80-
81-
$builder->add('name', 'custom_type');
82-
83-
rather than::
84-
85-
$builder->add('name', new CustomType());
75+
Existing form types can be modified defining
76+
:doc:`form type extensions </form/create_form_type_extension>`.
8677

8778
.. _override-validation:
8879

@@ -93,7 +84,7 @@ Symfony loads all validation configuration files from every bundle and
9384
combines them into one validation metadata tree. This means you are able to
9485
add new constraints to a property, but you cannot override them.
9586

96-
To override this, the 3rd party bundle needs to have configuration for
87+
To overcome this, the 3rd party bundle needs to have configuration for
9788
:doc:`validation groups </validation/groups>`. For instance, the FOSUserBundle
9889
has this configuration. To create your own validation, add the constraints
9990
to a new validation group:

bundles/prepend_extension.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
single: Configuration; Semantic
33
single: Bundle; Extension configuration
44

5-
How to Simplify Configuration of multiple Bundles
5+
How to Simplify Configuration of Multiple Bundles
66
=================================================
77

88
When building reusable and extensible applications, developers are often
@@ -12,9 +12,9 @@ users to choose to remove functionality they are not using. Creating multiple
1212
bundles has the drawback that configuration becomes more tedious and settings
1313
often need to be repeated for various bundles.
1414

15-
Using the below approach, it is possible to remove the disadvantage of the
16-
multiple bundle approach by enabling a single Extension to prepend the settings
17-
for any bundle. It can use the settings defined in the ``app/config/config.yml``
15+
It is possible to remove the disadvantage of the multiple bundle approach
16+
by enabling a single Extension to prepend the settings for any bundle.
17+
It can use the settings defined in the ``app/config/config.yml``
1818
to prepend settings just as if they had been written explicitly by
1919
the user in the application configuration.
2020

0 commit comments

Comments
 (0)