Reputation: 440
I have problem with polish characters in Doctrine. When I am using code below everything works fine and I am getting one record:
$em->getRepository('ePOSProductsBundle:Product')->findByName('Koszulka z małpka');
But when I am using another code below it doesn't work and I am not getting records:
$products = $qb->select('p')->from('ePOSProductsBundle:Product', 'p')
->where("p.name LIKE '%małpka%'")
->getQuery()
->getResult();
Does anyone know why this is not working?
Upvotes: 0
Views: 104
Reputation: 52483
$productName = 'małpka';
$result = $qb->select('p')
->from('ePOSProductsBundle:Product', 'p')
->where($qb->expr()->like('p.name', ':product_name'))
->setParameter('product_name', $product)
->getQuery()
->getResult();
Upvotes: 1