Skip to content

Commit bb7dcab

Browse files
committed
Merge pull request symfony-cmf#235 from dantleech/service_file_naming
Added standard for config file naming
2 parents 4da3ce4 + d29a94f commit bb7dcab

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

contributing/bundles.rst

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,39 @@ detail.
2323
General Bundle Standards
2424
------------------------
2525

26-
File Naming
27-
~~~~~~~~~~~
26+
Class File Naming
27+
~~~~~~~~~~~~~~~~~
2828

29-
Composite filenames (and by extension class names) SHOULD place the subject
30-
first:
29+
Composite class names SHOULD place the subject first:
3130

3231
+-------------------------+-------------------------+
3332
| Bad | Good |
3433
+=========================+=========================+
35-
| ``phpcr-admin.xml`` | ``admin-phpcr.xml`` |
36-
+-------------------------+-------------------------+
3734
| FoobarMenuNode | MenuNodeFoobar |
3835
+-------------------------+-------------------------+
3936
| AllFeaturesSimpleBlock | SimpleBlockAllFeatures |
4037
+-------------------------+-------------------------+
4138

39+
Configuration File Naming
40+
~~~~~~~~~~~~~~~~~~~~~~~~~
41+
42+
Configuration files for services SHOULD copy structure of the namespace up to
43+
the level of abstraction required. Each element of a namespace MAY also be
44+
compressed (e.g. event-listener => event).
45+
46+
A suffix may be added to allow different variations of the same configuration
47+
file.
48+
49+
Examples:
50+
51+
* ``event-imagine-phpcr.xml`` and ``event-imagine-orm.xml`` for an event
52+
subscriber with namespace
53+
``[BundleName]\EventListener\ImagineCacheInvalidatorSubscriber``
54+
* ``doctrine-phpcr.xml`` for all classes in the ``[BundleName]\Doctrine\Phpcr``
55+
namespace.
56+
* ``admin-imagine.xml`` for classes in the ``[BundleName]\Admin\Imagine``
57+
namespace.
58+
4259
Interface Naming
4360
~~~~~~~~~~~~~~~~
4461

@@ -81,7 +98,7 @@ If either or both "Read" and "Write" interfaces do not exist, then the
8198
Dependency Container Configuration
8299
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83100

84-
Refer the the `service naming conventions`_ in the symfony documentation.
101+
Refer to the `service naming conventions`_ in the Symfony documentation.
85102

86103
Meta: README, CHANGELOG, etc
87104
----------------------------

0 commit comments

Comments
 (0)