Код: Выделить всё
public function store(ValidatorInterface $validator, Request $request): JsonResponse
{
$collection = new Collection([
'type' => [
new Assert\Type('int'),
new Assert\Range(['min' => 1, 'max' => 2])
]
]);
$errors = $validator->validate($request->request->all(), $collection);
if ($errors->count()) {
dd($errors);
}
return new JsonResponse('OK');
}

Каков правильный способ проверки параметра int или строкового параметра как int в Symfony?
Подробнее здесь: https://stackoverflow.com/questions/739 ... ing-as-int
Мобильная версия