-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
base: 2.0.x
Are you sure you want to change the base?
Conversation
lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php
Outdated
Show resolved
Hide resolved
- fixed closure
@@ -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)); |
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.
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.
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.
@Majkl578 Done (PR updated)
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.
Why not using mb_stripos()
?
@Ocramius I'm waiting for this feature as well, what's the current state? |
This PR adds Comparison::ICONTAINS to create a case insensitive like.
Depends on doctrine PR#6547