use Symfony \ Component \ Validator \ Constraints as Assert;
/** * @var float $weight * * @ORM\Column(name="weight", type="decimal",precision=3,scale=2, nullable=true) * * @Assert\Range( * min = "90", * max = "350", * minMessage = "You must weight at least 90", * maxMessage = "You cannot weight more than 300" * ) * @Assert\NotBlank(groups={"group one","goup 2"}) * @Assert\Regex(pattern= "/[0-9]/",message="Require number only") */ private $weight=0;
source share