Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions reference/constraints/When.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ One way to accomplish this is with the When constraint:
{
#[Assert\GreaterThan(0)]
#[Assert\When(
expression: 'this.type == "percent"',
expression: 'this.getType() == "percent"',
constraints: [
new Assert\LessThanOrEqual(100, message: 'The value should be between 1 and 100!')
],
Expand All @@ -87,7 +87,7 @@ One way to accomplish this is with the When constraint:
value:
- GreaterThan: 0
- When:
expression: "this.type == 'percent'"
expression: "this.getType() == 'percent'"
constraints:
- LessThanOrEqual:
value: 100
Expand All @@ -105,7 +105,7 @@ One way to accomplish this is with the When constraint:
<constraint name="GreaterThan">0</constraint>
<constraint name="When">
<option name="expression">
this.type == 'percent'
this.getType() == 'percent'
</option>
<option name="constraints">
<constraint name="LessThanOrEqual">
Expand All @@ -132,7 +132,7 @@ One way to accomplish this is with the When constraint:
{
$metadata->addPropertyConstraint('value', new Assert\GreaterThan(0));
$metadata->addPropertyConstraint('value', new Assert\When([
'expression' => 'this.type == "percent"',
'expression' => 'this.getType() == "percent"',
'constraints' => [
new Assert\LessThanOrEqual([
'value' => 100,
Expand Down