Skip to content

Commit 23e2a8b

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: Fix the example for the When constraint
2 parents eff1c07 + 5ba520a commit 23e2a8b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reference/constraints/When.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ One way to accomplish this is with the When constraint:
6969
{
7070
#[Assert\GreaterThan(0)]
7171
#[Assert\When(
72-
expression: 'this.type == "percent"',
72+
expression: 'this.getType() == "percent"',
7373
constraints: [
7474
new Assert\LessThanOrEqual(100, message: 'The value should be between 1 and 100!')
7575
],
@@ -87,7 +87,7 @@ One way to accomplish this is with the When constraint:
8787
value:
8888
- GreaterThan: 0
8989
- When:
90-
expression: "this.type == 'percent'"
90+
expression: "this.getType() == 'percent'"
9191
constraints:
9292
- LessThanOrEqual:
9393
value: 100
@@ -105,7 +105,7 @@ One way to accomplish this is with the When constraint:
105105
<constraint name="GreaterThan">0</constraint>
106106
<constraint name="When">
107107
<option name="expression">
108-
this.type == 'percent'
108+
this.getType() == 'percent'
109109
</option>
110110
<option name="constraints">
111111
<constraint name="LessThanOrEqual">
@@ -132,7 +132,7 @@ One way to accomplish this is with the When constraint:
132132
{
133133
$metadata->addPropertyConstraint('value', new Assert\GreaterThan(0));
134134
$metadata->addPropertyConstraint('value', new Assert\When([
135-
'expression' => 'this.type == "percent"',
135+
'expression' => 'this.getType() == "percent"',
136136
'constraints' => [
137137
new Assert\LessThanOrEqual([
138138
'value' => 100,

0 commit comments

Comments
 (0)