19.
Validation with the UniqueEntity Constraint
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
5 Comments
Hi there, how would work to use the same validation for update? for registration works perfectly but for update if I send the same email complains email already exists.
Hey Celestino R.
You can use validation groups, or create another FormType only for updates that will change the constraints on your email property
More info about groups here: https://symfony.com/doc/cur...
Cheers!
I don't use forms it's an API. So I created a custom validation as could not see any better way.
I see, yes, in that case, using validation groups is the way to go
Hello.
I have 3 entities Business , Person, and Phone. In the Phone Entity I store all phone numbers created from the two other entities. My question is how to validate the Phone entity to be unique inside Person or Business, not unique in the whole table(Phone) ??
"Houston: no signs of life"
Start the conversation!