Skip to content

[DoctrineBridge] Added support for boolean value in UniqueEntity #28601

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

Conversation

ottaviano
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR symfony/symfony-docs#10404

Hi 👋,
little feature to allow to use UniqueEntityValidator with boolean type field (ex: Entity::enabled property) with ignoreFalse constraint option for allowing many entities with false value.

@linaori
Copy link
Contributor

linaori commented Sep 26, 2018

Thanks for proposing this feature! As I don't see a related ticket, can you explain why you need this feature and what use-cases this would support? That would greatly help the core team to decide whether or not this feature is right for Symfony or perhaps if another solution would be desired.

@ottaviano
Copy link
Contributor Author

ottaviano commented Sep 26, 2018

@linaori, for example, I have a Menu entity with the default boolean property, and I would like to allow to create only one menu with default=true value and many entities with default=false value. The same thing as with ignoreNull option of the UniqueEntity constraint.

@nicolas-grekas nicolas-grekas added this to the next milestone Sep 29, 2018
@ottaviano ottaviano force-pushed the add-boolean-support-to-unique-entity-validator branch from 70e6cad to 91868ae Compare October 1, 2018 15:26
@ottaviano ottaviano force-pushed the add-boolean-support-to-unique-entity-validator branch from 91868ae to 4824f2a Compare November 3, 2018 15:21
@ottaviano ottaviano force-pushed the add-boolean-support-to-unique-entity-validator branch from 4824f2a to 62a2857 Compare February 13, 2019 20:27
@ottaviano ottaviano force-pushed the add-boolean-support-to-unique-entity-validator branch from 62a2857 to 32c0332 Compare February 13, 2019 21:07
@ottaviano
Copy link
Contributor Author

Branch rebased.

@xabbuh
Copy link
Member

xabbuh commented Mar 8, 2019

I am not convinced that limiting this feature to false is desirable (the special handling for null is due to how null is handled by databases when using unique constraints there). IMO this feature would be better suited if you were allowed to give values for which there must not be more than one entry (could for example as well be the string enabled instead of a boolean true).

@ottaviano
Copy link
Contributor Author

hello @xabbuh, thank you for your review 👍
hm, I think it's a good idea, I'll try to do it

@javiereguiluz javiereguiluz changed the title [DoctrineBridge] Added support for boolen value in UniqueEntity [DoctrineBridge] Added support for boolean value in UniqueEntity Mar 28, 2019
@OskarStark
Copy link
Contributor

Hey @ottaviano 👋

Do you find some time to finish this PR?

@fabpot
Copy link
Member

fabpot commented Aug 9, 2019

I'm going to close this PR as there is no more activity nor feedback. @ottaviano Feel free to reopen it whenever you have time to finish it (if you want to).

@fabpot fabpot closed this Aug 9, 2019
@ottaviano
Copy link
Contributor Author

Hi @OskarStark & @fabpot, sorry for the silence, I did not have access to my emails during the holidays.
I completely forgot about this PR 😓
ok for closing it, and if I find time to finish, I will reopen it

@fabpot
Copy link
Member

fabpot commented Aug 9, 2019

@ottaviano No worries. Reopen it whenever you have time.

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants