ElPiter
ElPiter

Reputation: 4324

Symfony2 and Doctrine: how to use findOneBy method taking capitals into account

Using Symfony2, Doctrine and MySQL, I am using findOneBy method.

I need it to take capitals into account when talking about string criteria fields.

Example: imagine I have this path field in some table in my database.

id  path
---------
1   path1
2   path2
3   path3
4   path4

If I do findOneByPath("PATH2") it will find the second row.

The question: how can I make it to distinguish capitals, so that it wouldn't find any row in the described case?

Upvotes: 0

Views: 3442

Answers (1)

Manse
Manse

Reputation: 38147

The issue is not a doctrine/symfony issue - the problem is that your table collation is case-insensitive (this is the default), if you want searches to be case sensitive you need to use a different collation on your tables.

Upvotes: 2

Related Questions