I have a method in Doctrine repository to search a person like this:
function search($value)
{
$qb = $this->createQueryBuilder('p');
$qb->where($qb->expr()->like(
'LOWER(p.lastName)',
"'%" . mb_strtolower($value) . "%'"));
}
Example:
No | Name | Last name |
---|---|---|
1 | Luis | Sanchez |
2 | David | Sánchez |
When I use this method and the input is ‘Sanchez’ only returns record No. 1, and if the input is ‘Sánchez’ only returns record No. 2 (Change a for á). I need to get all records from my database no matter if the input contains any accent mark (á, é, í, ó, ú).
Source: Symfony Questions
Was this helpful?
0 / 0