This is the field in Entity:
/**
* @Assert\NotBlank(groups={"group1"})
* @Assert\Type(type="integer", groups={"group1"})
* @Assert\Range(min=0, groups={"group1"})
* @ORM\Column(type="integer")
*/
private $cableCount;
and this is the corresponding field in the form type:
$builder->add('cableCount', IntegerType::class, [
'label' => 'Cable Count',
'required' => true
]);
The field is rendered with up and down arrows and user can increase and decrease the values like 1, 2, 3, ... However user can also type in 3.45 and submit the form. No validation error pops up. just the value is rounded to 3. the expected behavior is to get a validation error informing the user that this field can accept only integer numbers.
How should I solve this issue? is there a built-in feature in symfony for this or should I create a custom constraint?