Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f9151b

Browse files
committed
Merge pull requestsymfony#2601 from WouterJ/update_override_docs
Update override article
2 parentsb15163a +7cf9458 commit2f9151b

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

‎cookbook/bundles/inheritance.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,9 @@ The same goes for routing files, validation configuration and other resources.
9797

9898
..caution::
9999

100-
Translation files do not work in the same way as described above. All
101-
translation files are accumulated into a set of "pools" (one for each)
102-
domain. Symfony loads translation files from bundles first (in the order
103-
that the bundles are initialized) and then from your ``app/Resources``
104-
directory. If the same translation is specified in two resources, the
105-
translation from the resource that's loaded last will win.
100+
Translation files do not work in the same way as described above. Read
101+
:ref:`override-translations` if you want to learn how to override
102+
translations.
106103

107104
.. _`FOSUserBundle`:https://github.com/friendsofsymfony/fosuserbundle
108105

‎cookbook/bundles/override.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Templates
1111
---------
1212

1313
For information on overriding templates, see
14+
1415
*:ref:`overriding-bundle-templates`.
1516
*:doc:`/cookbook/bundles/inheritance`
1617

@@ -31,6 +32,7 @@ Controllers
3132
Assuming the third-party bundle involved uses non-service controllers (which
3233
is almost always the case), you can easily override controllers via bundle
3334
inheritance. For more information, see:doc:`/cookbook/bundles/inheritance`.
35+
If the controller is a service, see the next section on how to override it.
3436

3537
Services & Configuration
3638
------------------------
@@ -94,7 +96,11 @@ like adding a method call - you can only use the compiler pass method.
9496
Entities & Entity mapping
9597
-------------------------
9698

97-
In progress...
99+
Due to the way Doctrine works, it is not possible to override entity mapping
100+
of a bundle. However, if a bundle provides a mapped superclass (such as the
101+
``User`` entity in the FOSUserBundle) one can override attributes and
102+
associations. Learn more about this feature and its limitations in
103+
`the Doctrine documentation`_.
98104

99105
Forms
100106
-----
@@ -116,7 +122,22 @@ Validation metadata
116122

117123
In progress...
118124

125+
.. _override-translations:
126+
119127
Translations
120128
------------
121129

122-
In progress...
130+
Translations are not related to bundles, but to domains. That means that you
131+
can override the translations from any translation file, as long as it is in
132+
:ref:`the correct domain<translation-domains>`.
133+
134+
..caution::
135+
136+
The last translation file always wins. That mean that you need to make
137+
sure to load the class which overrides the translation of another bundle
138+
before that bundle in the ``AppKernel``.
139+
140+
The file that always wins is the one that is placed in
141+
``app/Resources/translations``, as those files are always loaded as last.
142+
143+
.. _`the Doctrine documentation`:http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp