I am currently using symfony2, doctrine 2.3 and PostgreSQL 9. I have been looking for a couple of hours to see HOW to make ILIKE
select on earth using QueryBuilder
.
It seems they have only LIKE
. In my situation, however, I am looking for case insensitive. How it's done?
// -- this is the "like"; $search = 'user'; $query = $this->createQueryBuilder('users'); $query->where($query->expr()->like('users.username', $query->expr()->literal('%:username%')))->setParameter(':username', $search); // -- this is where I get "[Syntax Error] line 0, col 86: Error: Expected =, <, <=, <>, >, >=, !=, got 'ILIKE' $search = 'user'; $query = $this->createQueryBuilder('users'); $query->where('users.username ILIKE :username')->setParameter(':username', $search);
source share