Skip to content

Commit 562ff34

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Remove mentions of XML and Config Builders in Getting started guides
2 parents b7673c3 + 62bcb4e commit 562ff34

File tree

4 files changed

+12
-54
lines changed

4 files changed

+12
-54
lines changed

configuration.rst

Lines changed: 8 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ readable. These are the main advantages and disadvantages of each format:
6767
* **YAML**: simple, clean and readable, but not all IDEs support autocompletion
6868
and validation for it. :doc:`Learn the YAML syntax </reference/formats/yaml>`;
6969
* **PHP**: very powerful and it allows you to create dynamic configuration with
70-
arrays or a :ref:`ConfigBuilder <config-config-builder>`.
70+
arrays, and benefits from auto completion and static analysis using
71+
array shapes.
7172

7273
Importing Configuration Files
7374
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -88,9 +89,9 @@ configuration files, even if they use a different format:
8889
- { resource: '/etc/myapp/*.yaml' }
8990
9091
# ignore_errors: not_found silently discards errors if the loaded file doesn't exist
91-
- { resource: 'my_config_file.xml', ignore_errors: not_found }
92+
- { resource: 'my_config_file.php', ignore_errors: not_found }
9293
# ignore_errors: true silently discards all errors (including invalid code and not found)
93-
- { resource: 'my_other_config_file.xml', ignore_errors: true }
94+
- { resource: 'my_other_config_file.php', ignore_errors: true }
9495
9596
# ...
9697
@@ -212,7 +213,11 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
212213
'email_address' => param('app.admin_email'),
213214
214215
// ... but if you prefer it, you can also pass the name as a string
216+
<<<<<<< HEAD
215217
// surrounded by two % (same as in YAML format) and Symfony will
218+
=======
219+
// surrounded by two % (same as in the YAML format) and Symfony will
220+
>>>>>>> 7.4
216221
// replace it by that parameter value
217222
'email_address' => '%app.admin_email%',
218223
]);
@@ -1063,52 +1068,6 @@ parameters at once by type-hinting any of its constructor arguments with the
10631068
}
10641069
}
10651070

1066-
.. _config-config-builder:
1067-
1068-
Using PHP ConfigBuilders
1069-
------------------------
1070-
1071-
Writing PHP config is sometimes difficult because you end up with large nested
1072-
arrays and you have no autocompletion help from your favorite IDE. A way to
1073-
address this is to use "ConfigBuilders". They are objects that will help you
1074-
build these arrays.
1075-
1076-
Symfony generates the ConfigBuilder classes automatically in the
1077-
:ref:`kernel build directory <configuration-kernel-build-directory>` for all the
1078-
bundles installed in your application. By convention they all live in the
1079-
namespace ``Symfony\Config``::
1080-
1081-
// config/packages/security.php
1082-
use Symfony\Config\SecurityConfig;
1083-
1084-
return static function (SecurityConfig $security): void {
1085-
$security->firewall('main')
1086-
->pattern('^/*')
1087-
->lazy(true)
1088-
->security(false);
1089-
1090-
$security
1091-
->roleHierarchy('ROLE_ADMIN', ['ROLE_USER'])
1092-
->roleHierarchy('ROLE_SUPER_ADMIN', ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'])
1093-
->accessControl()
1094-
->path('^/user')
1095-
->roles('ROLE_USER');
1096-
1097-
$security->accessControl(['path' => '^/admin', 'roles' => 'ROLE_ADMIN']);
1098-
};
1099-
1100-
.. note::
1101-
1102-
Only root classes in the namespace ``Symfony\Config`` are ConfigBuilders.
1103-
Nested configs (e.g. ``\Symfony\Config\Framework\CacheConfig``) are regular
1104-
PHP objects which aren't autowired when using them as an argument type.
1105-
1106-
.. note::
1107-
1108-
In order to get ConfigBuilders autocompletion in your IDE/editor, make sure
1109-
to not exclude the directory where these classes are generated (by default,
1110-
in ``var/cache/dev/Symfony/Config/``).
1111-
11121071
Keep Going!
11131072
-----------
11141073

page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ try it out by going to: http://localhost:8000/lucky/number
8787

8888
Symfony recommends defining routes as attributes to have the controller code
8989
and its route configuration at the same location. However, if you prefer, you can
90-
:doc:`define routes in separate files </routing>` using YAML and PHP formats.
90+
:doc:`define routes in separate files </routing>` using the YAML or PHP formats.
9191

9292
If you see a lucky number being printed back to you, congratulations! But before
9393
you run off to play the lottery, check out how this works. Remember the two steps

routing.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ provides other useful features, like generating SEO-friendly URLs (e.g.
1212
Creating Routes
1313
---------------
1414

15-
Routes can be configured in YAML, PHP or using attributes.
16-
All formats provide the same features and performance, so choose
17-
your favorite.
15+
Routes can be configured in YAML, PHP or using attributes. All formats
16+
provide the same features and performance, so choose your favorite.
1817
:ref:`Symfony recommends attributes <best-practice-controller-attributes>`
1918
because it's convenient to put the route and controller in the same place.
2019

service_container.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ all their types (string, boolean, array, binary and PHP constant parameters).
586586

587587
However, there is another type of parameter related to services. In YAML config,
588588
any string which starts with ``@`` is considered as the ID of a service, instead
589-
of a regular string:
589+
of a regular string. In PHP config use the ``service()`` function:
590590

591591
.. configuration-block::
592592

0 commit comments

Comments
 (0)