Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DoctrineBridge] Allow to ignore specific nullable fields in UniqueEntity#49293

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:6.3fromVincentLanglet:uniqueEntity
May 19, 2023

Conversation

VincentLanglet
Copy link
Contributor

QA
Branch?6.3
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix #...
LicenseMIT
Doc PRsymfony/symfony-docs#... TODO

When the UniqueEntity is applied on multiple things the only option was

  • ignore all nullable values
  • do not ignore any nullable values

With this feature, it would be possible to ignore nullable values for specific field only and do not ignore nullable values for others.

alexislefebvre reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I think@malarzm has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@VincentLanglet
Copy link
ContributorAuthor

Hi@nicolas-grekas, Would you have some time to review this PR ?
Thanks a lot

@VincentLanglet
Copy link
ContributorAuthor

Hi@fabpot maybe you have some time to take a look or redirect me to the right reviewer ?

Thanks

Copy link
Contributor

@malarzmmalarzm left a 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?

@VincentLanglet
Copy link
ContributorAuthor

Frankly I have a hard time figuring out a use case for this. Could you please share one?

I have an entity of UserRoles which are related to

  • An Organization
  • A Project
  • A User
  • An email

For a specific Organization and Project, only one UserRole should exists.
But UserRole with no relation to a project can exists, it will be only related to a Project, it's only allowed one time.
And the User is nullable, because it's not set until the email is validated.

For the same User/Organization, you cannot have multiple null project
but for the same Organization/Project, you can have multiple null user (pending)

UniqueEntity(fields={organization, project, user}, ignoreNull={user})

Copy link
Contributor

@malarzmmalarzm left a 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!

@VincentLanglet
Copy link
ContributorAuthor

Would you have time to take a look/review this@nicolas-grekas@fabpot ?
Thanks a lot !

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@nicolas-grekasnicolas-grekas changed the title[Doctrine-bridge] Allow to ignore specific nullable fields in UniqueEntity[DoctrineBridge] Allow to ignore specific nullable fields in UniqueEntityMay 19, 2023
@nicolas-grekas
Copy link
Member

Thank you@VincentLanglet.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@malarzmmalarzmmalarzm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.3
Development

Successfully merging this pull request may close these issues.

5 participants
@VincentLanglet@carsonbot@nicolas-grekas@fabpot@malarzm

[8]ページ先頭

©2009-2025 Movatter.jp