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

0 commit comments

Comments
 (0)