Skip to content

Commit a788b0d

Browse files
committed
minor #8756 Updated validation/* articles to Symfony 4 (javiereguiluz)
This PR was merged into the 4.0 branch. Discussion ---------- Updated validation/* articles to Symfony 4 Please, double check that this change is correct: ``` // Before src/Resources/config/validation.{yml,xml,php} // After config/validator/validation.{yaml,xml,php} ``` Commits ------- c62b2d4 Updated validation/* articles to Symfony 4
2 parents 793e981 + c62b2d4 commit a788b0d

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ returned. Take this simple example from inside a controller::
132132
use App\Entity\Author;
133133

134134
// ...
135-
public function authorAction()
135+
public function author()
136136
{
137137
$author = new Author();
138138

validation/custom_constraint.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Using custom validators is very easy, just as the ones provided by Symfony itsel
107107
108108
.. code-block:: yaml
109109
110-
# src/Resources/config/validation.yml
110+
# config/validator/validation.yaml
111111
App\Entity\AcmeEntity:
112112
properties:
113113
name:
@@ -116,7 +116,7 @@ Using custom validators is very easy, just as the ones provided by Symfony itsel
116116
117117
.. code-block:: xml
118118
119-
<!-- src/Resources/config/validation.xml -->
119+
<!-- config/validator/validation.xml -->
120120
<?xml version="1.0" encoding="UTF-8" ?>
121121
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
122122
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -202,14 +202,14 @@ not to the property:
202202
203203
.. code-block:: yaml
204204
205-
# src/Resources/config/validation.yml
205+
# config/validator/validation.yaml
206206
App\Entity\AcmeEntity:
207207
constraints:
208208
- App\Validator\Constraints\ContainsAlphanumeric: ~
209209
210210
.. code-block:: xml
211211
212-
<!-- src/Resources/config/validation.xml -->
212+
<!-- config/validator/validation.xml -->
213213
<class name="App\Entity\AcmeEntity">
214214
<constraint name="App\Validator\Constraints\ContainsAlphanumeric" />
215215
</class>

validation/groups.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ user registers and when a user updates their contact information later:
4444
4545
.. code-block:: yaml
4646
47-
# src/Resources/config/validation.yml
47+
# config/validator/validation.yaml
4848
App\Entity\User:
4949
properties:
5050
email:
@@ -58,7 +58,7 @@ user registers and when a user updates their contact information later:
5858
5959
.. code-block:: xml
6060
61-
<!-- src/Resources/config/validation.xml -->
61+
<!-- config/validator/validation.xml -->
6262
<?xml version="1.0" encoding="UTF-8" ?>
6363
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
6464
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

validation/raw_values.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ looks like this::
1414
use Symfony\Component\Validator\Validator\ValidatorInterface;
1515

1616
// ...
17-
public function addEmailAction($email, ValidatorInterface $validator)
17+
public function addEmail($email, ValidatorInterface $validator)
1818
{
1919
$emailConstraint = new Assert\Email();
2020
// all constraint "options" can be set this way

validation/sequence_provider.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ username and the password are different only if all other validation passes
4949
5050
.. code-block:: yaml
5151
52-
# src/Resources/config/validation.yml
52+
# config/validator/validation.yaml
5353
App\Entity\User:
5454
group_sequence:
5555
- User
@@ -67,7 +67,7 @@ username and the password are different only if all other validation passes
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"
@@ -145,7 +145,7 @@ You can also define a group sequence in the ``validation_groups`` form option::
145145
use Symfony\Component\Validator\Constraints\GroupSequence;
146146
use Symfony\Component\Form\AbstractType;
147147
// ...
148-
148+
149149
class MyType extends AbstractType
150150
{
151151
// ...
@@ -195,7 +195,7 @@ entity and a new constraint group called ``Premium``:
195195
196196
.. code-block:: yaml
197197
198-
# src/Resources/config/validation.yml
198+
# config/validator/validation.yaml
199199
App\Entity\User:
200200
properties:
201201
name:
@@ -207,7 +207,7 @@ entity and a new constraint group called ``Premium``:
207207
208208
.. code-block:: xml
209209
210-
<!-- src/Resources/config/validation.xml -->
210+
<!-- config/validator/validation.xml -->
211211
<?xml version="1.0" encoding="UTF-8" ?>
212212
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
213213
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -308,13 +308,13 @@ provides a sequence of groups to be validated:
308308
309309
.. code-block:: yaml
310310
311-
# src/Resources/config/validation.yml
311+
# config/validator/validation.yaml
312312
App\Entity\User:
313313
group_sequence_provider: true
314314
315315
.. code-block:: xml
316316
317-
<!-- src/Resources/config/validation.xml -->
317+
<!-- config/validator/validation.xml -->
318318
<?xml version="1.0" encoding="UTF-8" ?>
319319
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
320320
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

validation/severity.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Use the ``payload`` option to configure the error level for each constraint:
5252
5353
.. code-block:: yaml
5454
55-
# src/Resources/config/validation.yml
55+
# config/validator/validation.yaml
5656
App\Entity\User:
5757
properties:
5858
username:
@@ -70,7 +70,7 @@ Use the ``payload`` option to configure the error level for each constraint:
7070
7171
.. code-block:: xml
7272
73-
<!-- src/Resources/config/validation.xml -->
73+
<!-- config/validator/validation.xml -->
7474
<?xml version="1.0" encoding="UTF-8" ?>
7575
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
7676
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

validation/translations.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ property is not empty, add the following:
8484
}
8585
}
8686
87-
Now, create a ``validators`` catalog file in the ``config/translations/`` directory:
87+
Now, create a ``validators`` catalog file in the ``translations/`` directory:
8888

8989
.. configuration-block::
9090

9191
.. code-block:: xml
9292
93-
<!-- config/translations/validators.en.xlf -->
93+
<!-- 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 ``config/translations/`` direct
105105
106106
.. code-block:: yaml
107107
108-
# config/translations/validators.en.yaml
108+
# translations/validators.en.yaml
109109
author.name.not_blank: Please enter an author name.
110110
111111
.. code-block:: php
112112
113-
// config/translations/validators.en.php
113+
// translations/validators.en.php
114114
return array(
115115
'author.name.not_blank' => 'Please enter an author name.',
116116
);

0 commit comments

Comments
 (0)