-
-
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
Improve Comparison::CONTAINS: allow to use the SQL wildcard characters #45
base: 2.0.x
Are you sure you want to change the base?
Conversation
I'm -1 for this:
If we want wilcard support, the only way is to uuse a new operator. We cannot change existing ones |
I agree, that a new operator would be a better solution, |
This is probably an actual |
@@ -152,7 +152,28 @@ public function walkComparison(Comparison $comparison) | |||
|
|||
case Comparison::CONTAINS: | |||
return function ($object) use ($field, $value) { | |||
return false !== strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); | |||
$field_value = ClosureExpressionVisitor::getObjectFieldValue($object, $field); |
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.
This API is uncovered by tests
The current issue cannot be closed even if #50 is accepted. this PR is about fixing a bug in the current implementation, where the SQL generated for CONTAINS is not consistent with the behavior of Doctrine Common. |
Thanks for clearing that up, @stof - missed that part completely while Marco Pivetta On 22 January 2015 at 11:38, Christophe Coevoet [email protected]
|
@stof I thought doctrine/orm#1150 about SQL .. (where you told about unescaped value) |
This pull additional to doctrine/orm#1150
And allow to use the SQL wildcard characters
%
and_
forComparison::CONTAINS
Allow to build the
contains
expressions like:Note: this changes can make b/c issue for existing
Comparison::CONTAINS
expressions, when someone use not escaped%
,_
.