Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 92e6058

Browse files
authored
Merge pull request #811 from symfony-cmf/bp-core
[core] change doc to best practices
2 parents ad2de8f + 2f4db7f commit 92e6058

File tree

5 files changed

+127
-100
lines changed

5 files changed

+127
-100
lines changed

bundles/core/configuration.rst

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ is the following configuration:
2323

2424
.. code-block:: yaml
2525
26+
# app/config/config.yml
2627
cmf_core:
2728
persistence:
2829
phpcr:
@@ -35,6 +36,7 @@ is the following configuration:
3536
3637
.. code-block:: xml
3738
39+
<!-- app/config/config.xml -->
3840
<?xml version="1.0" charset="UTF-8" ?>
3941
<container xmlns="http://symfony.com/schema/dic/services">
4042
@@ -55,18 +57,19 @@ is the following configuration:
5557
5658
.. code-block:: php
5759
58-
$container->loadFromExtension('cmf_core', array(
59-
'persistence' => array(
60-
'phpcr' => array(
60+
// app/config/config.php
61+
$container->loadFromExtension('cmf_core', [
62+
'persistence' => [
63+
'phpcr' => [
6164
'enabled' => false,
6265
'basepath' => '/cms/simple',
6366
'manager_registry' => 'doctrine_phpcr',
6467
'manager_name' => null,
6568
'use_sonata_admin' => 'auto',
6669
'translation_strategy' => null,
67-
),
68-
),
69-
));
70+
],
71+
],
72+
]);
7073
7174
``orm``
7275
.......
@@ -78,6 +81,7 @@ is the following configuration:
7881

7982
.. code-block:: yaml
8083
84+
# app/config/config.yml
8185
cmf_core:
8286
persistence:
8387
orm:
@@ -87,6 +91,7 @@ is the following configuration:
8791
8892
.. code-block:: xml
8993
94+
<!-- app/config/config.xml -->
9095
<?xml version="1.0" charset="UTF-8" ?>
9196
<container xmlns="http://symfony.com/schema/dic/services">
9297
@@ -104,15 +109,16 @@ is the following configuration:
104109
105110
.. code-block:: php
106111
107-
$container->loadFromExtension('cmf_core', array(
108-
'persistence' => array(
109-
'phpcr' => array(
112+
// app/config/config.php
113+
$container->loadFromExtension('cmf_core', [
114+
'persistence' => [
115+
'phpcr' => [
110116
'enabled' => false,
111117
'manager_name' => null,
112118
'use_sonata_admin' => 'auto',
113-
),
114-
),
115-
));
119+
],
120+
],
121+
]);
116122
117123
``enabled``
118124
"""""""""""
@@ -221,12 +227,14 @@ bundles that use this configuration:
221227

222228
.. code-block:: yaml
223229
230+
# app/config/config.yml
224231
cmf_core:
225232
multilang:
226233
locales: [en, fr]
227234
228235
.. code-block:: xml
229236
237+
<!-- app/config/config.xml -->
230238
<?xml version="1.0" charset="UTF-8" ?>
231239
<container xmlns="http://symfony.com/schema/dic/services">
232240
@@ -240,14 +248,15 @@ bundles that use this configuration:
240248
241249
.. code-block:: php
242250
243-
$container->loadFromExtension('cmf_core', array(
244-
'multilang' => array(
245-
'locales' => array(
251+
// app/config/config.php
252+
$container->loadFromExtension('cmf_core', [
253+
'multilang' => [
254+
'locales' => [
246255
'en',
247256
'fr',
248-
),
249-
),
250-
));
257+
],
258+
],
259+
]);
251260
252261
``locales``
253262
...........
@@ -267,6 +276,7 @@ only published routes and content can be accessed.
267276

268277
.. code-block:: yaml
269278
279+
# app/config/config.yml
270280
cmf_core:
271281
publish_workflow:
272282
enabled: true
@@ -276,6 +286,7 @@ only published routes and content can be accessed.
276286
277287
.. code-block:: xml
278288
289+
<!-- app/config/config.xml -->
279290
<?xml version="1.0" charset="UTF-8" ?>
280291
<container xmlns="http://symfony.com/schema/dic/services">
281292
@@ -291,14 +302,15 @@ only published routes and content can be accessed.
291302
292303
.. code-block:: php
293304
294-
$container->loadFromExtension('cmf_core', array(
295-
'publish_workflow' => array(
305+
// app/config/config.php
306+
$container->loadFromExtension('cmf_core', [
307+
'publish_workflow' => [
296308
'enabled' => true,
297309
'checker_service' => 'cmf_core.publish_workflow.checker.default',
298310
'view_non_published_role' => 'ROLE_CAN_VIEW_NON_PUBLISHED',
299311
'request_listener' => true,
300-
),
301-
));
312+
],
313+
]);
302314
303315
Sonata Admin
304316
------------
@@ -313,6 +325,7 @@ This section configures the Sonata Admin Extensions, see:
313325

314326
.. code-block:: yaml
315327
328+
# app/config/config.yml
316329
cmf_core:
317330
sonata_admin:
318331
extensions:
@@ -325,6 +338,7 @@ This section configures the Sonata Admin Extensions, see:
325338
326339
.. code-block:: xml
327340
341+
<!-- app/config/config.xml -->
328342
<?xml version="1.0" charset="UTF-8" ?>
329343
<container xmlns="http://symfony.com/schema/dic/services">
330344
@@ -341,21 +355,22 @@ This section configures the Sonata Admin Extensions, see:
341355
342356
.. code-block:: php
343357
344-
$container->loadFromExtension('cmf_core', array(
345-
'sonata_admin' => array(
346-
'extensions' => array(
347-
'publishable' => array(
358+
// app/config/config.php
359+
$container->loadFromExtension('cmf_core', [
360+
'sonata_admin' => [
361+
'extensions' => [
362+
'publishable' => [
348363
'form_group' => 'form.group_publish_workflow',
349-
),
350-
'publish_time' => array(
364+
],
365+
'publish_time' => [
351366
'form_group' => 'form.group_general',
352-
),
353-
'translatable' => array(
367+
],
368+
'translatable' => [
354369
'form_group' => 'form.group_general',
355-
),
356-
),
357-
),
358-
));
370+
],
371+
],
372+
],
373+
]);
359374
360375
``form_group``
361376
~~~~~~~~~~~~~~

bundles/core/forms.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ typically a "terms and conditions" document. When using this type, you
1414
additionally specify ``content_ids``, which are understood by the
1515
:doc:`DynamicRouter <../routing/dynamic>`, along with replacement tokens::
1616

17-
$form->add('terms', 'cmf_core_checkbox_url_label', array(
17+
$form->add('terms', 'cmf_core_checkbox_url_label', [
1818
'label' => 'I have seen the <a href="%team%">Team</a> and <a href="%more%">More</a> pages ...',
19-
'content_ids' => array(
19+
'content_ids' => [
2020
'%team%' => '/cms/content/static/team',
2121
'%more%' => '/cms/content/static/more',
22-
),
23-
));
22+
],
23+
]);
2424

2525
The form type automatically generates the routes for the specified content and
2626
passes the routes to the ``trans`` Twig helper for replacement in the label.

bundles/core/persistence.rst

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ the following to your main configuration file:
1616

1717
.. code-block:: yaml
1818
19-
cmf_core:
20-
persistence:
21-
phpcr: ~
19+
# app/config/config.yml
20+
services:
21+
cmf_core:
22+
persistence:
23+
phpcr: ~
2224
2325
.. code-block:: xml
2426
27+
<!-- app/config/config.xml -->
2528
<?xml version="1.0" charset="UTF-8" ?>
2629
<container xmlns="http://symfony.com/schema/dic/services">
2730
@@ -35,11 +38,12 @@ the following to your main configuration file:
3538
3639
.. code-block:: php
3740
38-
$container->loadFromExtension('cmf_core', array(
39-
'persistence' => array(
40-
'phpcr' => array(),
41-
),
42-
));
41+
// app/config/config.php
42+
$container->loadFromExtension('cmf_core', [
43+
'persistence' => [
44+
'phpcr' => [],
45+
],
46+
]);
4347
4448
.. _bundles-core-multilang-persisting_multilang_documents:
4549

@@ -64,35 +68,36 @@ enforce a single translation strategy for all documents:
6468

6569
.. code-block:: yaml
6670
71+
# app/config/config.yml
6772
cmf_core:
6873
persistence:
6974
phpcr:
7075
translation_strategy: attribute
7176
7277
.. code-block:: xml
7378
79+
<!-- app/config/config.xml -->
7480
<?xml version="1.0" charset="UTF-8" ?>
7581
<container xmlns="http://symfony.com/schema/dic/services">
7682
7783
<config xmlns="http://cmf.symfony.com/schema/dic/core">
7884
<persistence>
79-
<phpcr
80-
translation-strategy="attribute"
81-
/>
85+
<phpcr translation-strategy="attribute"/>
8286
</persistence>
8387
</config>
8488
8589
</container>
8690
8791
.. code-block:: php
8892
89-
$container->loadFromExtension('cmf_core', array(
90-
'persistence' => array(
91-
'phpcr' => array(
93+
// app/config/config.php
94+
$container->loadFromExtension('cmf_core', [
95+
'persistence' => [
96+
'phpcr' => [
9297
'translation_strategy' => 'attribute',
93-
),
94-
),
95-
));
98+
],
99+
],
100+
]);
96101
97102
.. caution::
98103

@@ -152,17 +157,17 @@ configuration in the ``sonata_admin`` section of your project configuration:
152157
.. code-block:: php
153158
154159
// app/config/config.php
155-
$container->loadFromExtension('sonata_admin', array(
160+
$container->loadFromExtension('sonata_admin', [
156161
// ...
157-
'extensions' => array(
158-
'cmf_core.admin_extension.child' => array(
159-
'implements' => array(
162+
'extensions' => [
163+
'cmf_core.admin_extension.child' => [
164+
'implements' => [
160165
'Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface',
161166
'Doctrine\ODM\PHPCR\HierarchyInterface',
162-
),
163-
),
164-
),
165-
));
167+
],
168+
],
169+
],
170+
]);
166171
167172
See the `Sonata Admin extension documentation`_ for more information.
168173

@@ -209,16 +214,16 @@ configuration in the ``sonata_admin`` section of your project configuration:
209214
.. code-block:: php
210215
211216
// app/config/config.php
212-
$container->loadFromExtension('sonata_admin', array(
217+
$container->loadFromExtension('sonata_admin', [
213218
// ...
214-
'extensions' => array(
215-
'cmf_core.admin_extension.translatable' => array(
216-
'implements' => array(
219+
'extensions' => [
220+
'cmf_core.admin_extension.translatable' => [
221+
'implements' => [
217222
'Symfony\Cmf\Bundle\CoreBundle\Translatable\TranslatableInterface',
218-
),
219-
),
220-
),
221-
));
223+
],
224+
],
225+
],
226+
]);
222227
223228
See the `Sonata Admin extension documentation`_ for more information.
224229

0 commit comments

Comments
 (0)