File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -14,25 +14,28 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\Negative`
14
14
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ LesserThanValidator `
15
15
========== ===================================================================
16
16
17
+ .. versionadded :: 4.3
18
+
19
+ The ``Negative `` constraint was introduced in Symfony 4.3.
20
+
17
21
Basic Usage
18
22
-----------
19
23
20
- The following constraints ensure that:
24
+ The following constraint ensure that:
21
25
22
26
* the ``withdraw `` of a bankaccount ``TransferItem `` is a negative number (lesser than zero)
23
27
24
28
.. configuration-block ::
25
29
26
30
.. code-block :: php-annotations
27
31
28
- // src/Entity/Freezer .php
32
+ // src/Entity/TransferItem .php
29
33
namespace App\Entity;
30
34
31
35
use Symfony\Component\Validator\Constraints as Assert;
32
36
33
37
class TransferItem
34
38
{
35
-
36
39
/**
37
40
* @Assert\Negative
38
41
*/
@@ -74,6 +77,6 @@ The following constraints ensure that:
74
77
{
75
78
public static function loadValidatorMetadata(ClassMetadata $metadata)
76
79
{
77
- $metadata->addPropertyConstraint('withdraw', new Assert\Negative;
80
+ $metadata->addPropertyConstraint('withdraw', new Assert\Negative() ;
78
81
}
79
82
}
Original file line number Diff line number Diff line change @@ -14,10 +14,14 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\Positive`
14
14
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ GreaterThanValidator `
15
15
========== ===================================================================
16
16
17
+ .. versionadded :: 4.3
18
+
19
+ The ``Positive `` constraint was introduced in Symfony 4.3.
20
+
17
21
Basic Usage
18
22
-----------
19
23
20
- The following constraints ensure that:
24
+ The following constraint ensure that:
21
25
22
26
* the ``income `` of an ``Employee `` is a positive number (greater than zero)
23
27
@@ -32,7 +36,6 @@ The following constraints ensure that:
32
36
33
37
class Employee
34
38
{
35
-
36
39
/**
37
40
* @Assert\Positive
38
41
*/
@@ -74,6 +77,6 @@ The following constraints ensure that:
74
77
{
75
78
public static function loadValidatorMetadata(ClassMetadata $metadata)
76
79
{
77
- $metadata->addPropertyConstraint('income', new Assert\Positive;
80
+ $metadata->addPropertyConstraint('income', new Assert\Positive() ;
78
81
}
79
82
}
Original file line number Diff line number Diff line change @@ -15,10 +15,14 @@ Class :class:`Symfony\\Component\\Validator\\Constraints\\PositiveOrZero`
15
15
Validator :class: `Symfony\\ Component\\ Validator\\ Constraints\\ GreaterThanOrEqualValidator `
16
16
========== ===================================================================
17
17
18
+ .. versionadded :: 4.3
19
+
20
+ The ``PositiveOrZero `` constraint was introduced in Symfony 4.3.
21
+
18
22
Basic Usage
19
23
-----------
20
24
21
- The following constraints ensure that:
25
+ The following constraint ensure that:
22
26
23
27
* the number of ``siblings `` of a ``Person `` is positive or zero
24
28
@@ -74,6 +78,6 @@ The following constraints ensure that:
74
78
{
75
79
public static function loadValidatorMetadata(ClassMetadata $metadata)
76
80
{
77
- $metadata->addPropertyConstraint('siblings', new Assert\PositiveOrZero);
81
+ $metadata->addPropertyConstraint('siblings', new Assert\PositiveOrZero( );
78
82
}
79
83
}
You can’t perform that action at this time.
0 commit comments