Skip to content

Commit b14c33c

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: streamline the constraints reference
2 parents cbf32ab + 41fa05e commit b14c33c

29 files changed

+57
-71
lines changed

reference/constraints/All.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ entry in that array:
3636
* @Assert\Length(min=5)
3737
* })
3838
*/
39-
protected $favoriteColors = [];
39+
protected $favoriteColors = [];
4040
}
4141
4242
.. code-block:: yaml

reference/constraints/Bic.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ will contain a Business Identifier Code (BIC).
7474
7575
class Transaction
7676
{
77-
protected $businessIdentifierCode;
78-
7977
public static function loadValidatorMetadata(ClassMetadata $metadata)
8078
{
8179
$metadata->addPropertyConstraint('businessIdentifierCode', new Assert\Bic());

reference/constraints/Callback.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ Configuration
8484
{
8585
$metadata->addConstraint(new Assert\Callback('validate'));
8686
}
87+
88+
public function validate(ExecutionContextInterface $context, $payload)
89+
{
90+
// ...
91+
}
8792
}
8893
8994
The Callback Method

reference/constraints/CardScheme.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ on an object that will contain a credit card number.
8181
8282
class Transaction
8383
{
84-
protected $cardNumber;
85-
8684
public static function loadValidatorMetadata(ClassMetadata $metadata)
8785
{
8886
$metadata->addPropertyConstraint('cardNumber', new Assert\CardScheme([

reference/constraints/Choice.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ If your valid choice list is simple, you can pass them in directly via the
108108
109109
class Author
110110
{
111-
protected $genre;
112-
113111
public static function loadValidatorMetadata(ClassMetadata $metadata)
114112
{
115113
$metadata->addPropertyConstraint(

reference/constraints/Collection.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ following:
138138
139139
class Author
140140
{
141-
private $options = [];
142-
143141
public static function loadValidatorMetadata(ClassMetadata $metadata)
144142
{
145143
$metadata->addPropertyConstraint('profileData', new Assert\Collection([
@@ -205,7 +203,7 @@ you can do the following:
205203
* }
206204
* )
207205
*/
208-
protected $profileData = ['personal_email'];
206+
protected $profileData = ['personal_email'];
209207
}
210208
211209
.. code-block:: yaml
@@ -269,9 +267,10 @@ you can do the following:
269267
{
270268
$metadata->addPropertyConstraint('profileData', new Assert\Collection([
271269
'fields' => [
272-
'personal_email' => new Assert\Required(
273-
[new Assert\NotBlank(), new Assert\Email()]
274-
),
270+
'personal_email' => new Assert\Required([
271+
new Assert\NotBlank(),
272+
new Assert\Email(),
273+
]),
275274
'alternate_email' => new Assert\Optional(new Assert\Email()),
276275
],
277276
]));

reference/constraints/Count.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ you might add the following:
4242
* maxMessage = "You cannot specify more than {{ limit }} emails"
4343
* )
4444
*/
45-
protected $emails = [];
45+
protected $emails = [];
4646
}
4747
4848
.. code-block:: yaml
@@ -90,8 +90,8 @@ you might add the following:
9090
public static function loadValidatorMetadata(ClassMetadata $metadata)
9191
{
9292
$metadata->addPropertyConstraint('emails', new Assert\Count([
93-
'min' => 1,
94-
'max' => 5,
93+
'min' => 1,
94+
'max' => 5,
9595
'minMessage' => 'You must specify at least one email',
9696
'maxMessage' => 'You cannot specify more than {{ limit }} emails',
9797
]));

reference/constraints/Country.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Basic Usage
2929
/**
3030
* @Assert\Country
3131
*/
32-
protected $country;
32+
protected $country;
3333
}
3434
3535
.. code-block:: yaml

reference/constraints/Date.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Basic Usage
3131
* @Assert\Date
3232
* @var string A "Y-m-d" formatted value
3333
*/
34-
protected $birthday;
34+
protected $birthday;
3535
}
3636
3737
.. code-block:: yaml

reference/constraints/DateTime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Basic Usage
3232
* @Assert\DateTime
3333
* @var string A "Y-m-d H:i:s" formatted value
3434
*/
35-
protected $createdAt;
35+
protected $createdAt;
3636
}
3737
3838
.. code-block:: yaml

0 commit comments

Comments
 (0)