From 193901a57ee67175718245d2d80a165c1809abc5 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 4 May 2013 12:27:25 +0200 Subject: [PATCH 1/3] Documented 'Entities & Entity mapping' section --- cookbook/bundles/override.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 2846f2a0764..45ac7a59b49 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -94,7 +94,11 @@ like adding a method call - you can only use the compiler pass method. Entities & Entity mapping ------------------------- -In progress... +Due to the way Doctrine works, it is not possible to override entity mapping +of a bundle. However, if a bundle provides a mapped superclass (such as the +``User`` entity in the FOSUserBundle) one can override attributes and +associations. Learn more about this feature and its limitations in +`the Doctrine documentation`_. Forms ----- @@ -120,3 +124,5 @@ Translations ------------ In progress... + +.. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides From a55a705536378c7ffbe4cb6401f4d0da41db2acf Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 4 May 2013 13:43:11 +0200 Subject: [PATCH 2/3] Documented "translation" section --- cookbook/bundles/inheritance.rst | 9 +++------ cookbook/bundles/override.rst | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index 7090d4ffe01..81ed5f8bab1 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -97,12 +97,9 @@ The same goes for routing files, validation configuration and other resources. .. caution:: - Translation files do not work in the same way as described above. All - translation files are accumulated into a set of "pools" (one for each) - domain. Symfony loads translation files from bundles first (in the order - that the bundles are initialized) and then from your ``app/Resources`` - directory. If the same translation is specified in two resources, the - translation from the resource that's loaded last will win. + Translation files do not work in the same way as described above. Read + :ref:`override-translations` if you want to learn how to override + translations. .. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 45ac7a59b49..76cbaecbdc3 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -11,6 +11,7 @@ Templates --------- For information on overriding templates, see + * :ref:`overriding-bundle-templates`. * :doc:`/cookbook/bundles/inheritance` @@ -120,9 +121,22 @@ Validation metadata In progress... +.. _override-translations: + Translations ------------ -In progress... +Translations are not related to bundles, but to domains. That means that you +can override the translations from any translation file, as long as it is in +:ref:`the correct domain `. + +.. caution:: + + The last translation file always wins. That mean that you need to make + sure to load the class which overrides the translation of another bundle + before that bundle in the ``AppKernel``. + + The file that always wins is the one that is placed in + ``app/Resources/translations``, as those files are always loaded as last. .. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides From 7cf94589194eebd8147b1eda7ac4b5d120969475 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 4 May 2013 13:51:38 +0200 Subject: [PATCH 3/3] Clearified controllers as services --- cookbook/bundles/override.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 76cbaecbdc3..7979089cb6b 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -32,6 +32,7 @@ Controllers Assuming the third-party bundle involved uses non-service controllers (which is almost always the case), you can easily override controllers via bundle inheritance. For more information, see :doc:`/cookbook/bundles/inheritance`. +If the controller is a service, see the next section on how to override it. Services & Configuration ------------------------