Skip to content
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 like #123

Open
wants to merge 5 commits into
base: 2.0.x
Choose a base branch
from

Conversation

okoehler
Copy link

@okoehler okoehler commented Jul 11, 2017

This PR adds Comparison::ICONTAINS to create a case insensitive like.

Depends on doctrine PR#6547

@@ -173,6 +173,11 @@ public function walkComparison(Comparison $comparison)
return false !== strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value);
};

case Comparison::ICONTAINS:
return function ($object) use ($field, $value) {
return false !== strpos(mb_strtolower(ClosureExpressionVisitor::getObjectFieldValue($object, $field)), mb_strtolower($value));
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, although it's correct, using mb_strtolower introduces dependency on ext-mbstring, which is not bundled in PHP. It's not hard dependency (required only when ICONTAINS is used), but it should probably be added to suggest section in the composer.json.

Copy link
Author

Choose a reason for hiding this comment

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

@Majkl578 Done (PR updated)

Copy link
Member

Choose a reason for hiding this comment

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

Why not using mb_stripos()?

@isisis
Copy link

isisis commented Feb 13, 2018

@Ocramius I'm waiting for this feature as well, what's the current state?

Base automatically changed from master to 2.0.x January 19, 2021 07:23
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.

6 participants