Skip to content

Commit 9416d6e

Browse files
committed
document the validation payload option
1 parent 640b29e commit 9416d6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+147
-10
lines changed

reference/constraints/All.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ you to apply a collection of constraints to each element of the array.
88
| Applies to | :ref:`property or method <validation-property-target>` |
99
+----------------+------------------------------------------------------------------------+
1010
| Options | - `constraints`_ |
11+
| | - `payload`_ |
1112
+----------------+------------------------------------------------------------------------+
1213
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\All` |
1314
+----------------+------------------------------------------------------------------------+
@@ -107,3 +108,5 @@ constraints
107108

108109
This required option is the array of validation constraints that you want
109110
to apply to each element of the underlying array.
111+
112+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Blank.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ blank, see :doc:`/reference/constraints/NotBlank`.
1010
| Applies to | :ref:`property or method <validation-property-target>` |
1111
+----------------+-----------------------------------------------------------------------+
1212
| Options | - `message`_ |
13+
| | - `payload`_ |
1314
+----------------+-----------------------------------------------------------------------+
1415
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Blank` |
1516
+----------------+-----------------------------------------------------------------------+
@@ -87,3 +88,5 @@ message
8788
**type**: ``string`` **default**: ``This value should be blank.``
8889

8990
This is the message that will be shown if the value is not blank.
91+
92+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Callback.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ can do anything, including creating and assigning validation errors.
2626
| Applies to | :ref:`class <validation-class-target>` |
2727
+----------------+------------------------------------------------------------------------+
2828
| Options | - :ref:`callback <callback-option>` |
29+
| | - `payload`_ |
2930
+----------------+------------------------------------------------------------------------+
3031
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Callback` |
3132
+----------------+------------------------------------------------------------------------+
@@ -302,3 +303,5 @@ instance as only argument.
302303
Static or closure callbacks receive the validated object as the first argument
303304
and the :class:`Symfony\\Component\\Validator\\ExecutionContextInterface`
304305
instance as the second argument.
306+
307+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/CardScheme.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ through a payment gateway.
1010
+----------------+--------------------------------------------------------------------------+
1111
| Options | - `schemes`_ |
1212
| | - `message`_ |
13+
| | - `payload`_ |
1314
+----------------+--------------------------------------------------------------------------+
1415
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\CardScheme` |
1516
+----------------+--------------------------------------------------------------------------+
@@ -124,4 +125,6 @@ message
124125

125126
The message shown when the value does not pass the ``CardScheme`` check.
126127

128+
.. include:: /reference/constraints/_payload-option.rst.inc
129+
127130
.. _`Wikipedia: Issuer identification number (IIN)`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29

reference/constraints/Choice.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ an array of items is one of those valid choices.
1818
| | - `minMessage`_ |
1919
| | - `maxMessage`_ |
2020
| | - `strict`_ |
21+
| | - `payload`_ |
2122
+----------------+-----------------------------------------------------------------------+
2223
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Choice` |
2324
+----------------+-----------------------------------------------------------------------+
@@ -89,11 +90,11 @@ If your valid choice list is simple, you can pass them in directly via the
8990
9091
use Symfony\Component\Validator\Mapping\ClassMetadata;
9192
use Symfony\Component\Validator\Constraints as Assert;
92-
93+
9394
class Author
9495
{
9596
protected $gender;
96-
97+
9798
public static function loadValidatorMetadata(ClassMetadata $metadata)
9899
{
99100
$metadata->addPropertyConstraint('gender', new Assert\Choice(array(
@@ -176,11 +177,11 @@ constraint.
176177
177178
use Symfony\Component\Validator\Mapping\ClassMetadata;
178179
use Symfony\Component\Validator\Constraints as Assert;
179-
180+
180181
class Author
181182
{
182183
protected $gender;
183-
184+
184185
public static function loadValidatorMetadata(ClassMetadata $metadata)
185186
{
186187
$metadata->addPropertyConstraint('gender', new Assert\Choice(array(
@@ -244,11 +245,11 @@ you can pass the class name and the method as an array.
244245
245246
use Symfony\Component\Validator\Mapping\ClassMetadata;
246247
use Symfony\Component\Validator\Constraints as Assert;
247-
248+
248249
class Author
249250
{
250251
protected $gender;
251-
252+
252253
public static function loadValidatorMetadata(ClassMetadata $metadata)
253254
{
254255
$metadata->addPropertyConstraint('gender', new Assert\Choice(array(
@@ -349,3 +350,5 @@ strict
349350
If true, the validator will also check the type of the input value. Specifically,
350351
this value is passed to as the third argument to the PHP :phpfunction:`in_array` method
351352
when checking to see if a value is in the valid choices array.
353+
354+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Collection.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and that extra keys are not present.
1818
| | - `extraFieldsMessage`_ |
1919
| | - `allowMissingFields`_ |
2020
| | - `missingFieldsMessage`_ |
21+
| | - `payload`_ |
2122
+----------------+--------------------------------------------------------------------------+
2223
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Collection` |
2324
+----------------+--------------------------------------------------------------------------+
@@ -328,3 +329,5 @@ missingFieldsMessage
328329

329330
The message shown if `allowMissingFields`_ is false and one or more fields
330331
are missing from the underlying collection.
332+
333+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Count.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ element count is *between* some minimum and maximum value.
1212
| | - `minMessage`_ |
1313
| | - `maxMessage`_ |
1414
| | - `exactMessage`_ |
15+
| | - `payload`_ |
1516
+----------------+---------------------------------------------------------------------+
1617
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Count` |
1718
+----------------+---------------------------------------------------------------------+
@@ -139,3 +140,5 @@ exactMessage
139140

140141
The message that will be shown if min and max values are equal and the underlying collection elements
141142
count is not exactly this value.
143+
144+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Country.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Validates that a value is a valid `ISO 3166-1 alpha-2`_ country code.
77
| Applies to | :ref:`property or method <validation-property-target>` |
88
+----------------+------------------------------------------------------------------------+
99
| Options | - `message`_ |
10+
| | - `payload`_ |
1011
+----------------+------------------------------------------------------------------------+
1112
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Country` |
1213
+----------------+------------------------------------------------------------------------+
@@ -82,4 +83,6 @@ message
8283

8384
This message is shown if the string is not a valid country code.
8485

86+
.. include:: /reference/constraints/_payload-option.rst.inc
87+
8588
.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes

reference/constraints/Currency.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Validates that a value is a valid `3-letter ISO 4217`_ currency name.
1010
| Applies to | :ref:`property or method<validation-property-target>` |
1111
+----------------+---------------------------------------------------------------------------+
1212
| Options | - `message`_ |
13+
| | - `payload`_ |
1314
+----------------+---------------------------------------------------------------------------+
1415
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Currency` |
1516
+----------------+---------------------------------------------------------------------------+
@@ -88,4 +89,6 @@ message
8889

8990
This is the message that will be shown if the value is not a valid currency.
9091

92+
.. include:: /reference/constraints/_payload-option.rst.inc
93+
9194
.. _`3-letter ISO 4217`: http://en.wikipedia.org/wiki/ISO_4217

reference/constraints/Date.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ valid YYYY-MM-DD format.
99
| Applies to | :ref:`property or method <validation-property-target>` |
1010
+----------------+--------------------------------------------------------------------+
1111
| Options | - `message`_ |
12+
| | - `payload`_ |
1213
+----------------+--------------------------------------------------------------------+
1314
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Date` |
1415
+----------------+--------------------------------------------------------------------+
@@ -83,3 +84,5 @@ message
8384
**type**: ``string`` **default**: ``This value is not a valid date.``
8485

8586
This message is shown if the underlying data is not a valid date.
87+
88+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/DateTime.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ a valid YYYY-MM-DD HH:MM:SS format.
99
| Applies to | :ref:`property or method <validation-property-target>` |
1010
+----------------+------------------------------------------------------------------------+
1111
| Options | - `message`_ |
12+
| | - `payload`_ |
1213
+----------------+------------------------------------------------------------------------+
1314
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\DateTime` |
1415
+----------------+------------------------------------------------------------------------+
@@ -83,3 +84,5 @@ message
8384
**type**: ``string`` **default**: ``This value is not a valid datetime.``
8485

8586
This message is shown if the underlying data is not a valid datetime.
87+
88+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Email.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cast to a string before being validated.
1111
| | - `message`_ |
1212
| | - `checkMX`_ |
1313
| | - `checkHost`_ |
14+
| | - `payload`_ |
1415
+----------------+---------------------------------------------------------------------+
1516
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Email` |
1617
+----------------+---------------------------------------------------------------------+
@@ -99,7 +100,7 @@ strict
99100
**type**: ``boolean`` **default**: ``false``
100101

101102
When false, the email will be validated against a simple regular expression.
102-
If true, then the `egulias/email-validator`_ library is required to perform
103+
If true, then the `egulias/email-validator`_ library is required to perform
103104
an RFC compliant validation.
104105

105106
message
@@ -126,4 +127,6 @@ If true, then the :phpfunction:`checkdnsrr` PHP function will be used to
126127
check the validity of the MX *or* the A *or* the AAAA record of the host
127128
of the given email.
128129

130+
.. include:: /reference/constraints/_payload-option.rst.inc
131+
129132
.. _egulias/email-validator: https://packagist.org/packages/egulias/email-validator

reference/constraints/EqualTo.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ force that a value is *not* equal, see :doc:`/reference/constraints/NotEqualTo`.
1818
+----------------+-----------------------------------------------------------------------+
1919
| Options | - `value`_ |
2020
| | - `message`_ |
21+
| | - `payload`_ |
2122
+----------------+-----------------------------------------------------------------------+
2223
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\EqualTo` |
2324
+----------------+-----------------------------------------------------------------------+
@@ -104,3 +105,5 @@ message
104105
**type**: ``string`` **default**: ``This value should be equal to {{ compared_value }}.``
105106

106107
This is the message that will be shown if the value is not equal.
108+
109+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Expression.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ gives you similar flexibility.
1414
+----------------+-----------------------------------------------------------------------------------------------+
1515
| Options | - :ref:`expression <reference-constraint-expression-option>` |
1616
| | - `message`_ |
17+
| | - `payload`_ |
1718
+----------------+-----------------------------------------------------------------------------------------------+
1819
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Expression` |
1920
+----------------+-----------------------------------------------------------------------------------------------+
@@ -258,3 +259,5 @@ message
258259
**type**: ``string`` **default**: ``This value is not valid.``
259260

260261
The default message supplied when the expression evaluates to false.
262+
263+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/False.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Also see :doc:`True <True>`.
1111
| Applies to | :ref:`property or method <validation-property-target>` |
1212
+----------------+---------------------------------------------------------------------+
1313
| Options | - `message`_ |
14+
| | - `payload`_ |
1415
+----------------+---------------------------------------------------------------------+
1516
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\False` |
1617
+----------------+---------------------------------------------------------------------+
@@ -115,3 +116,5 @@ message
115116
**type**: ``string`` **default**: ``This value should be false.``
116117

117118
This message is shown if the underlying data is not false.
119+
120+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/File.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ form type.
3030
| | - `uploadIniSizeErrorMessage`_ |
3131
| | - `uploadFormSizeErrorMessage`_ |
3232
| | - `uploadErrorMessage`_ |
33+
| | - `payload`_ |
3334
+----------------+---------------------------------------------------------------------+
3435
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\File` |
3536
+----------------+---------------------------------------------------------------------+
@@ -276,6 +277,7 @@ The message that is displayed if the uploaded file could not be uploaded
276277
for some unknown reason, such as the file upload failed or it couldn't be written
277278
to disk.
278279

280+
.. include:: /reference/constraints/_payload-option.rst.inc
279281

280282
.. _`IANA website`: http://www.iana.org/assignments/media-types/index.html
281283
.. _`Wikipedia: Binary prefix`: http://en.wikipedia.org/wiki/Binary_prefix

reference/constraints/GreaterThan.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ than another value, see :doc:`/reference/constraints/LessThan`.
1414
+----------------+---------------------------------------------------------------------------+
1515
| Options | - `value`_ |
1616
| | - `message`_ |
17+
| | - `payload`_ |
1718
+----------------+---------------------------------------------------------------------------+
1819
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThan` |
1920
+----------------+---------------------------------------------------------------------------+
@@ -101,3 +102,5 @@ message
101102

102103
This is the message that will be shown if the value is not greater than the
103104
comparison value.
105+
106+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/GreaterThanOrEqual.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ the options. To force that a value is greater than another value, see
1313
+----------------+----------------------------------------------------------------------------------+
1414
| Options | - `value`_ |
1515
| | - `message`_ |
16+
| | - `payload`_ |
1617
+----------------+----------------------------------------------------------------------------------+
1718
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\GreaterThanOrEqual` |
1819
+----------------+----------------------------------------------------------------------------------+
@@ -100,3 +101,5 @@ message
100101

101102
This is the message that will be shown if the value is not greater than or equal
102103
to the comparison value.
104+
105+
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Iban.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ transcription errors.
1313
| Applies to | :ref:`property or method<validation-property-target>` |
1414
+----------------+-----------------------------------------------------------------------+
1515
| Options | - `message`_ |
16+
| | - `payload`_ |
1617
+----------------+-----------------------------------------------------------------------+
1718
| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Iban` |
1819
+----------------+-----------------------------------------------------------------------+
@@ -98,4 +99,6 @@ message
9899

99100
The default message supplied when the value does not pass the Iban check.
100101

102+
.. include:: /reference/constraints/_payload-option.rst.inc
103+
101104
.. _`International Bank Account Number (IBAN)`: http://en.wikipedia.org/wiki/International_Bank_Account_Number

0 commit comments

Comments
 (0)