New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DoctrineBridge] Allow to ignore specific nullable fields in UniqueEntity #49293
Conversation
e083fb1
to
beee940
Compare
beee940
to
c982ea5
Compare
Hey! I think @malarzm has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
Hi @nicolas-grekas, Would you have some time to review this PR ? |
Hi @fabpot maybe you have some time to take a look or redirect me to the right reviewer ? Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly I have a hard time figuring out a use case for this. Could you please share one?
src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
Show resolved
Hide resolved
I have an entity of UserRoles which are related to
For a specific Organization and Project, only one UserRole should exists. For the same User/Organization, you cannot have multiple null project
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the use case, it makes more sense now!
c982ea5
to
be7de29
Compare
Would you have time to take a look/review this @nicolas-grekas @fabpot ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
Outdated
Show resolved
Hide resolved
ad8ce8a
to
0e61a66
Compare
Thank you @VincentLanglet. |
When the UniqueEntity is applied on multiple things the only option was
With this feature, it would be possible to ignore nullable values for specific field only and do not ignore nullable values for others.