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

Ilike #654

Closed
wants to merge 1 commit into from
Closed

Ilike #654

wants to merge 1 commit into from

Conversation

lighthart
Copy link

Ilike (insensitive like) expression added for postgres support

@Majkl578
Copy link
Contributor

Ilike is platform-dependent, it should not be part of Doctrine itself.
By the way, this might be a good time to propose some kind of user-land AST extendability. Once I wanted to extend AST by custom syntax and found out it is not possible at all.

@@ -173,11 +173,21 @@ public function testLikeExpr()
$this->assertEquals('a.description LIKE :description', (string) $this->_expr->like('a.description', ':description'));
}

public function testLikeExpr()
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably meant testILikeExpr, since this one is already declared.

@mvrhov
Copy link

mvrhov commented Apr 27, 2013

According to the SQL standard LIKE is supposed to be case insensitive.. PostgreSQL makes it case sensitive so ORM should use ILIKE on PostgreSQL platform by default. However changing this would be a BC break.

@beberlei
Copy link
Member

The same is a problem for Sqlite which is case sensitive by default afaik, in MySQL it depends on the collation. I don't think we can find a sufficient solution here that works on all platforms.

I have to reject this PR, because its PostgreSQL specific and DQL is platform independent. You can "fix" this for you, by extending the PostgreSQLPlatform in DBAL and changing the LIKE Expression for Postrgres.

@greg0ire
Copy link
Member

You can "fix" this for you, by extending the PostgreSQLPlatform in DBAL and changing the LIKE Expression for Postrgres.

Sorry to dig that up, but there is no getLikeExpression() or something like that, LIKE is hardcoded here I believe : https://github.com/doctrine/doctrine2/blob/c1943624ab1260c629316bab104dc5130c060154/lib/Doctrine/ORM/Query/SqlWalker.php#L2162

@Ocramius
Copy link
Member

What @beberlei meant here is probably defining a custom DQL string function.

@greg0ire
Copy link
Member

Thanks for clarifying that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants