Skip to content

Commit 87c7b9a

Browse files
committed
Reword
1 parent 4052620 commit 87c7b9a

File tree

2 files changed

+49
-46
lines changed

2 files changed

+49
-46
lines changed

reference/configuration/framework.rst

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,51 @@ paths
23062306
**type**: ``array`` **default**: ``[]``
23072307

23082308
This option allows to define an array of paths with files or directories where
2309-
the component will look for additional validation files.
2309+
the component will look for additional validation files:
2310+
2311+
.. configuration-block::
2312+
2313+
.. code-block:: yaml
2314+
2315+
# config/packages/framework.yaml
2316+
framework:
2317+
validation:
2318+
mapping:
2319+
paths:
2320+
- "%kernel.project_dir%/validation/"
2321+
2322+
.. code-block:: xml
2323+
2324+
<!-- config/packages/framework.xml -->
2325+
<?xml version="1.0" encoding="UTF-8" ?>
2326+
<container xmlns="http://symfony.com/schema/dic/services"
2327+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2328+
xmlns:framework="http://symfony.com/schema/dic/symfony"
2329+
xsi:schemaLocation="http://symfony.com/schema/dic/services
2330+
https://symfony.com/schema/dic/services/services-1.0.xsd
2331+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
2332+
2333+
<framework:config>
2334+
<framework:validation>
2335+
<framework:mapping>
2336+
<framework:path>%kernel.project_dir%/validation</framework:path>
2337+
</framework:mapping>
2338+
</framework:validation>
2339+
</framework:config>
2340+
</container>
2341+
2342+
.. code-block:: php
2343+
2344+
// config/packages/framework.php
2345+
$container->loadFromExtension('framework', [
2346+
'validation' => [
2347+
'mapping' => [
2348+
'paths' => [
2349+
'%kernel.project_dir%/validation',
2350+
],
2351+
],
2352+
],
2353+
]);
23102354
23112355
annotations
23122356
~~~~~~~~~~~

validation.rst

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -279,52 +279,11 @@ previous configuration by the following:
279279
],
280280
]);
281281
282-
By default, config files are located in the ``config/validator/`` directory.
283-
It is possible to define an array of paths with files or directories where the component will look for additional validation files:
284-
285-
.. configuration-block::
286-
287-
.. code-block:: yaml
288-
289-
# config/packages/framework.yaml
290-
framework:
291-
validation:
292-
mapping:
293-
paths:
294-
- "%kernel.project_dir%/validation/"
295-
296-
.. code-block:: xml
297-
298-
<!-- config/packages/framework.xml -->
299-
<?xml version="1.0" encoding="UTF-8" ?>
300-
<container xmlns="http://symfony.com/schema/dic/services"
301-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
302-
xmlns:framework="http://symfony.com/schema/dic/symfony"
303-
xsi:schemaLocation="http://symfony.com/schema/dic/services
304-
https://symfony.com/schema/dic/services/services-1.0.xsd
305-
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
306-
307-
<framework:config>
308-
<framework:validation>
309-
<framework:mapping>
310-
<framework:path>%kernel.project_dir%/validation</framework:path>
311-
</framework:mapping>
312-
</framework:validation>
313-
</framework:config>
314-
</container>
315-
316-
.. code-block:: php
282+
.. tip::
317283

318-
// config/packages/framework.php
319-
$container->loadFromExtension('framework', [
320-
'validation' => [
321-
'mapping' => [
322-
'paths' => [
323-
'%kernel.project_dir%/validation',
324-
],
325-
],
326-
],
327-
]);
284+
When using PHP, YAML, and XML files instead of annotations, Symfony looks
285+
for by default in the ``config/validator/`` directory, but you can configure
286+
other directories with the :ref:`validation.mapping.paths <reference-validation-mapping>` option.
328287

329288
.. index::
330289
single: Validation; Constraints

0 commit comments

Comments
 (0)