8000 Add new validator config & translations path · symfony/symfony-docs@a953fc0 · GitHub
[go: up one dir, main page]

Skip to content

Commit a953fc0

Browse files
committed
Add new validator config & translations path
1 parent 66bb046 commit a953fc0

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

validation.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ following:
5959
6060
.. code-block:: yaml
6161
62-
# src/Resources/config/validation.yml
62+
# config/validator/validation.yaml
6363
App\Entity\Author:
6464
properties:
6565
name:
6666
- NotBlank: ~
6767
6868
.. code-block:: xml
6969
70-
<!-- src/Resources/config/validation.xml -->
70+
<!-- config/validator/validation.xml -->
7171
<?xml version="1.0" encoding="UTF-8" ?>
7272
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
7373
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -214,13 +214,13 @@ file:
214214

215215
.. code-block:: yaml
216216
217-
# app/config/config.yml
217+
# config/packages/framework.yaml
218218
framework:
219219
validation: { enabled: true }
220220
221221
.. code-block:: xml
222222
223-
<!-- app/config/config.xml -->
223+
<!-- config/packages/framework.xml -->
224224
<?xml version="1.0" encoding="UTF-8" ?>
225225
<container xmlns="http://symfony.com/schema/dic/services"
226226
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -236,7 +236,7 @@ file:
236236
237237
.. code-block:: php
238238
239-
// app/config/config.php
239+
// config/packages/framework.php
240240
$container->loadFromExtension('framework', array(
241241
'validation' => array(
242242
'enabled' => true,
@@ -250,13 +250,13 @@ previous configuration by the following:
250250

251251
.. code-block:: yaml
252252
253-
# app/config/config.yml
253+
# config/packages/framework.yml
254254
framework:
255255
validation: { enable_annotations: true }
256256
257257
.. code-block:: xml
258258
259-
<!-- app/config/config.xml -->
259+
<!-- config/packages/framework.xml -->
260260
<?xml version="1.0" encoding="UTF-8" ?>
261261
<container xmlns="http://symfony.com/schema/dic/services"
262262
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -272,7 +272,7 @@ previous configuration by the following:
272272
273273
.. code-block:: php
274274
275-
// app/config/config.php
275+
// config/packages/framework.php
276276
$container->loadFromExtension('framework', array(
277277
'validation' => array(
278278
'enable_annotations' => true,
@@ -346,7 +346,7 @@ literature genre mostly associated with the author, which can be set to either
346346
347347
.. code-block:: yaml
348348
349-
# src/Resources/config/validation.yml
349+
# config/validator/validation.yaml
350350
App\Entity\Author:
351351
properties:
352352
genre:
@@ -355,7 +355,7 @@ literature genre mostly associated with the author, which can be set to either
355355
356356
.. code-block:: xml
357357
358-
<!-- src/Resources/config/validation.xml -->
358+
<!-- config/validator/validation.xml -->
359359
<?xml version="1.0" encoding="UTF-8" ?>
360360
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
361361
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -430,7 +430,7 @@ options can be specified in this way.
430430
431431
.. code-block:: yaml
432432
433-
# src/Resources/config/validation.yml
433+
# config/validator/validation.yml
434434
App\Entity\Author:
435435
properties:
436436
genre:
@@ -439,7 +439,7 @@ options can be specified in this way.
439439
440440
.. code-block:: xml
441441
442-
<!-- src/Resources/config/validation.xml -->
442+
<!-- config/validator/validation.xml -->
443443
<?xml version="1.0" encoding="UTF-8" ?>
444444
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
445445
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -559,7 +559,7 @@ class to have at least 3 characters.
559559
560560
.. code-block:: yaml
561561
562-
# src/Resources/config/validation.yml
562+
# config/validator/validation.yaml
563563
App\Entity\Author:
564564
properties:
565565
firstName:
@@ -569,7 +569,7 @@ class to have at least 3 characters.
569569
570570
.. code-block:: xml
571571
572-
<!-- src/Resources/config/validation.xml -->
572+
<!-- config/validator/validation.xml -->
573573
<?xml version="1.0" encoding="UTF-8" ?>
574574
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
575575
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -647,15 +647,15 @@ this method must return ``true``:
647647
648648
.. code-block:: yaml
649649
650-
# src/Resources/config/validation.yml
650+
# config/validator/validation.yaml
651651
App\Entity\Author:
652652
getters:
653653
passwordLegal:
654654
- 'IsTrue': { message: 'The password cannot match your first name' }
655655
656656
.. code-block:: xml
657657
658-
<!-- src/Resources/config/validation.xml -->
658+
<!-- config/validator/validation.xml -->
659659
<?xml version="1.0" encoding="UTF-8" ?>
660660
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
661661
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

validation/translations.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ property is not empty, add the following:
4040
4141
.. code-block:: yaml
4242
43-
# src/Resources/config/validation.yml
43+
# config/validator/validation.yaml
4444
App\Entity\Author:
4545
properties:
4646
name:
4747
- NotBlank: { message: 'author.name.not_blank' }
4848
4949
.. code-block:: xml
5050
51-
<!-- src/Resources/config/validation.xml -->
51+
<!-- config/validator/validation.xml -->
5252
<?xml version="1.0" encoding="UTF-8" ?>
5353
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
5454
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -84,13 +84,13 @@ property is not empty, add the following:
8484
}
8585
}
8686
87-
Now, create a ``validators`` catalog file in the ``app/Resources/translations`` directory:
87+
Now, create a ``validators`` catalog file in the ``config/translations/`` directory:
8888

8989
.. configuration-block::
9090

9191
.. code-block:: xml
9292
93-
<!-- app/Resources/translations/validators.en.xlf -->
93+
<!-- config/translations/validators.en.xlf -->
9494
<?xml version="1.0"?>
9595
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
9696
<file source-language="en" datatype="plaintext" original="file.ext">
@@ -105,12 +105,12 @@ Now, create a ``validators`` catalog file in the ``app/Resources/translations``
105105
106106
.. code-block:: yaml
107107
108-
# app/Resources/translations/validators.en.yml
108+
# config/translations/validators.en.yaml
109109
author.name.not_blank: Please enter an author name.
110110
111111
.. code-block:: php
112112
113-
// app/Resources/translations/validators.en.php
113+
// config/translations/validators.en.php
114114
return array(
115115
'author.name.not_blank' => 'Please enter an author name.',
116116
);

0 commit comments

Comments
 (0)
0