wiki/content/20201112140917-number_constraints.md

44 lines
528 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-12
2024-05-06 20:40:05 +00:00
id: adc652c4-6f67-46e9-a975-8e72b852234c
title: Number Constraints
---
# Syntax
``` php
use Symfony\Component\Validator\Constraints as Assert;
class Person
{
/** @Assert\PositiveOrZero */
protected $siblings;
// ...
}
class Employee
{
/** @Assert\Positive */
protected $income;
// ...
}
class UnderGroundGarage
{
/** @Assert\NegativeOrZero */
protected $level;
// ...
}
class TransferItem
{
/** @Assert\Negative */
protected $withdraw;
// ...
}
```