Answer the question
In order to leave comments, you need to log in
UniqueEntity symfony how to apply in Controller?
$constraint = new Assert\Collection([
'username' => new Assert\NotBlank(['message' => 'Укажите ФИО']),
'email' => new Assert\NotBlank(['message' => 'Укажите Email']),
'phone' => new Assert\NotBlank(['message' => 'Укажите телефон']),
'password' => new Assert\NotBlank(['message' => 'Введите пароль']),
'check' => new Assert\NotBlank(['message' => 'Вы должны согласиться на обработку данных']),
]);
$violations = $validator->validate($data, $constraint);
Answer the question
In order to leave comments, you need to log in
In essence, specify unique=true
And validate - a simple selection from the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question