-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Case-insensitive getBy #404
Comments
The use-case seems pretty reasonable to support directly in Orm. This is possible to do yourself. There are few differences between Orm 3.1 & 4 (master) - but they are mainly just in naming of the supporting classes.
|
Postponing to 4.1. But in 4.0 it should be really possible on your own. |
I did a small research on case sensitivity, accents and text normalization and this was my best in-database (postgresql) solution: CREATE COLLATION ori_cmf.ignore_case_and_accents (
provider = "icu",
locale = "und@colStrength=primary",
deterministic = false
);
CREATE TABLE ori_cmf.emails
(
"email_address" varchar(254) COLLATE ori_cmf.ignore_case_and_accents NOT NULL CHECK ("email_address" IS NORMALIZED)
); Strings are considered equal even if:
For different use cases, I have these collations: CREATE COLLATION ori_cmf.strict (
provider = "icu",
locale = "und-x-icu",
deterministic = true
);
CREATE COLLATION ori_cmf.ignore_case (
provider = "icu",
locale = "und-u-ks-level2",
deterministic = false
);
CREATE COLLATION ori_cmf.ignore_accents (
provider = "icu",
locale = "und@colStrength=primary;colCaseLevel=yes",
deterministic = false
);
CREATE COLLATION ori_cmf.ignore_case_and_accents (
provider = "icu",
locale = "und@colStrength=primary",
deterministic = false
); Of course it would be nice to have equal functions in orm, to be compatible with array mapper, but this may be good enough for most :) |
Hi, I use PostgreSQL as a DB engine and I have a problem with case-sensitive columns.
For example I would like to have
User::$email
as case-insensitive. Is possible to set case-sensitivity for one specified column/attribute? It would be awesome to set something like:@property string $email {case-insensitive}
Then all methods like
findBy
,getBy
... would useILIKE
instead of=
.Or is there any easy way how to do it? Thank you.
The text was updated successfully, but these errors were encountered: