I've see the major post on the Doctrine "LIKE" query topic (see, for instance this one). I have a SYmfony2 application. In a controller I call an entity repository to make a query. In particular, in the entity repository I define the following function:
return $this->getEntityManager()
->createQuery("SELECT p FROM AcmePromoBundle:Promo p
JOIN p.product pr
WHERE pr.name LIKE 'La'")->getResult();
It works but doesn't return anything, because there is no Product (pr) such that its name is La. Then, I try to add the % character inside the SQL query like follows here:
"SELECT p FROM AcmePromoBundle:Promo p JOIN p.product pr WHERE pr.name LIKE 'La%'"
and here:
"SELECT p FROM AcmePromoBundle:Promo p JOIN p.product pr WHERE pr.name LIKE La%"
but the following error is returned "Class true does not exist". I also tried to use "setParameter" function but it doesn't work! Any idea?