我有这个查询代码:
$repository = $em->getRepository('AcmeCrawlerBundle:Trainings');
$query = $repository->createQueryBuilder('p')
->where('p.title LIKE :word')
->orWhere('p.discription LIKE :word')
->setParameter('word', $word)
->getQuery();
$trainings = $query->getResult();
问题是:即使存在匹配项,此查询也找不到它们。我用这段代码来查看完整的 sql:
print_r(array(
'sql' => $query->getSQL(),
'parameters' => $query->getParameters(),
));
我有什么:
FROM Trainings t0_ WHERE t0_.title LIKE ? OR t0_.discription LIKE ? [parameters] => Array ( [word] => Spoken )
(查询的最后一部分)请告诉我要改变什么?