Answer the question
In order to leave comments, you need to log in
Validation for uniqueness?
https://symfony.com/doc/current/reference/constrai...
Doesn't fit, because it needs to be written in the entity.
And it is necessary to validate the data even before the entity is.
$constraint = new Assert(
[
'email' => [
new UniqueEntity(
[
'fields' => 'email',
'errorPath' => 'email',
'entityClass' => User::class,
//'em' => 'some service id',
//'repositoryMethod' => 'findBy',
'message' => 'Not unique email'
]
),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question