From f684bdd817ce3ae16dc60e4f544d0797c2e0bec9 Mon Sep 17 00:00:00 2001 From: Francisco Corrales Morales Date: Tue, 20 Sep 2016 10:35:36 -0600 Subject: [PATCH 1/7] Update inheritance.rst The old sentence was confusing. This one works better. --- bundles/inheritance.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/inheritance.rst b/bundles/inheritance.rst index 5d9a77c9793..c7a27eeab90 100644 --- a/bundles/inheritance.rst +++ b/bundles/inheritance.rst @@ -93,8 +93,8 @@ The same goes for routing files and some other resources. The overriding of resources only works when you refer to resources with the ``@FOSUserBundle/Resources/config/routing/security.xml`` method. - If you refer to resources without using the ``@BundleName`` shortcut, they - can't be overridden in this way. + You need to use the ``@BundleName`` shortcut when refering to resources + so they can be successfully overridden. .. caution:: From 3433e5029916185ab7af42a3262b2c8c302e7b69 Mon Sep 17 00:00:00 2001 From: Francisco Corrales Morales Date: Tue, 20 Sep 2016 10:36:35 -0600 Subject: [PATCH 2/7] Update installation.rst Its better to use e.g. here cause that is just an example. Doesn't always going to be in that path. --- bundles/installation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/installation.rst b/bundles/installation.rst index 3b8f4cef20b..9fdc1cec53e 100644 --- a/bundles/installation.rst +++ b/bundles/installation.rst @@ -49,7 +49,7 @@ version, include it as the second argument of the `composer require`_ command: B) Enable the Bundle -------------------- -At this point, the bundle is installed in your Symfony project (in +At this point, the bundle is installed in your Symfony project (e.g. ``vendor/friendsofsymfony/``) and the autoloader recognizes its classes. The only thing you need to do now is register the bundle in ``AppKernel``:: @@ -108,14 +108,14 @@ via the ``config:dump-reference`` command: .. code-block:: terminal - $ app/console config:dump-reference AsseticBundle + $ bin/console config:dump-reference AsseticBundle Instead of the full bundle name, you can also pass the short name used as the root of the bundle's configuration: .. code-block:: terminal - $ app/console config:dump-reference assetic + $ bin/console config:dump-reference assetic The output will look like this: From 2f837d6febe2bda5eda5589661485bad47b0da50 Mon Sep 17 00:00:00 2001 From: Francisco Corrales Morales Date: Tue, 20 Sep 2016 10:37:34 -0600 Subject: [PATCH 3/7] Update override.rst The word 'or' is clear. / not so much. --- bundles/override.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bundles/override.rst b/bundles/override.rst index 2cbd05134dc..564afadacb9 100644 --- a/bundles/override.rst +++ b/bundles/override.rst @@ -39,7 +39,7 @@ Services & Configuration If you want to modify service definitions of another bundle, you can use a compiler pass to change the class of the service or to modify method calls. In the following -example, the implementing class for the ``original-service-id`` is changed to +example, the implementing class for the ``original-service-id`` is changed to ``Acme\DemoBundle\YourService``:: // src/Acme/DemoBundle/DependencyInjection/Compiler/OverrideServiceCompilerPass.php @@ -72,17 +72,16 @@ associations. Learn more about this feature and its limitations in Forms ----- -In order to override a form type, it has to be registered as a service (meaning -it is tagged as ``form.type``). You can then override it as you would override any -service as explained in `Services & Configuration`_. This, of course, will only -work if the type is referred to by its alias rather than being instantiated, -e.g.:: +Form types are referred to by their fully-qualified class name:: - $builder->add('name', 'custom_type'); + $builder->add('name', CustomType::class); -rather than:: +This means that you cannot override this by creating a sub-class of ``CustomType`` +and registering it as a service and tagging it with ``form.type`` (you *could* +do this in an earlier version). - $builder->add('name', new CustomType()); +Instead, you should use a "form type extension" to modify the existing form type. +For more information, see :doc:`/form/create_form_type_extension`. .. _override-validation: @@ -93,7 +92,7 @@ Symfony loads all validation configuration files from every bundle and combines them into one validation metadata tree. This means you are able to add new constraints to a property, but you cannot override them. -To override this, the 3rd party bundle needs to have configuration for +To overcome this, the 3rd party bundle needs to have configuration for :doc:`validation groups `. For instance, the FOSUserBundle has this configuration. To create your own validation, add the constraints to a new validation group: From 62bfc21a8a68dc316aa7956873b1c9b956f82d58 Mon Sep 17 00:00:00 2001 From: Francisco Corrales Morales Date: Tue, 20 Sep 2016 10:38:33 -0600 Subject: [PATCH 4/7] Update prepend_extension.rst Titles use caps. Unnecessary sentence. --- bundles/prepend_extension.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 5d28080eaec..3b4107f7b70 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -2,7 +2,7 @@ single: Configuration; Semantic single: Bundle; Extension configuration -How to Simplify Configuration of multiple Bundles +How to Simplify Configuration of Multiple Bundles ================================================= 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 bundles has the drawback that configuration becomes more tedious and settings often need to be repeated for various bundles. -Using the below approach, it is possible to remove the disadvantage of the -multiple bundle approach by enabling a single Extension to prepend the settings -for any bundle. It can use the settings defined in the ``app/config/config.yml`` +It is possible to remove the disadvantage of the multiple bundle approach +by enabling a single Extension to prepend the settings for any bundle. +It can use the settings defined in the ``app/config/config.yml`` to prepend settings just as if they had been written explicitly by the user in the application configuration. From 600d302b18b093fe0a73b53976fcb229d03a814a Mon Sep 17 00:00:00 2001 From: Francisco Corrales Morales Date: Wed, 21 Sep 2016 10:07:53 -0600 Subject: [PATCH 5/7] Update installation.rst This does only apply to Symfony >= 3.0. --- bundles/installation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/installation.rst b/bundles/installation.rst index 9fdc1cec53e..4c5a5bbbd7f 100644 --- a/bundles/installation.rst +++ b/bundles/installation.rst @@ -108,14 +108,14 @@ via the ``config:dump-reference`` command: .. code-block:: terminal - $ bin/console config:dump-reference AsseticBundle + $ app/console config:dump-reference AsseticBundle Instead of the full bundle name, you can also pass the short name used as the root of the bundle's configuration: .. code-block:: terminal - $ bin/console config:dump-reference assetic + $ app/console config:dump-reference assetic The output will look like this: From d5cd8d0e35250acd7acb83b040447912c9e96155 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 14 Feb 2017 16:06:39 +0100 Subject: [PATCH 6/7] Reworded the section about form overridding --- bundles/override.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/bundles/override.rst b/bundles/override.rst index 564afadacb9..9eda7803d2f 100644 --- a/bundles/override.rst +++ b/bundles/override.rst @@ -72,15 +72,7 @@ associations. Learn more about this feature and its limitations in Forms ----- -Form types are referred to by their fully-qualified class name:: - - $builder->add('name', CustomType::class); - -This means that you cannot override this by creating a sub-class of ``CustomType`` -and registering it as a service and tagging it with ``form.type`` (you *could* -do this in an earlier version). - -Instead, you should use a "form type extension" to modify the existing form type. +Existing form types can be modified defining "form type extensions". For more information, see :doc:`/form/create_form_type_extension`. .. _override-validation: From c9a52ae0aff186331ff65b7e285238b78c9f19ab Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 15 Apr 2017 15:56:41 +0200 Subject: [PATCH 7/7] Added the changes suggested by reviewers --- bundles/inheritance.rst | 3 ++- bundles/override.rst | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bundles/inheritance.rst b/bundles/inheritance.rst index c7a27eeab90..14e0ebc0081 100644 --- a/bundles/inheritance.rst +++ b/bundles/inheritance.rst @@ -94,7 +94,8 @@ The same goes for routing files and some other resources. The overriding of resources only works when you refer to resources with the ``@FOSUserBundle/Resources/config/routing/security.xml`` method. You need to use the ``@BundleName`` shortcut when refering to resources - so they can be successfully overridden. + so they can be successfully overridden (except templates, which are + overridden in a different way, as explained in :doc:`/templating/overriding`). .. caution:: diff --git a/bundles/override.rst b/bundles/override.rst index 9eda7803d2f..37c38481472 100644 --- a/bundles/override.rst +++ b/bundles/override.rst @@ -72,8 +72,8 @@ associations. Learn more about this feature and its limitations in Forms ----- -Existing form types can be modified defining "form type extensions". -For more information, see :doc:`/form/create_form_type_extension`. +Existing form types can be modified defining +:doc:`form type extensions `. .. _override-validation: