I do:
$text = '%'.addslashes($text).'%';
$images = $this->getDoctrine()->getEntityManager()
->createQuery("SELECT img, cat, u
FROM AcmeMainBundle:Image img
JOIN img.category cat
JOIN img.user u
WHERE img.title LIKE '$text' OR img.description LIKE '$text'
ORDER BY img.id DESC")
->getResult();
and when $text contains some ' than it throws error
[Syntax Error] line 0, col 150: Error: Expected end of string, got 'T' 500 Internal Server Error - QueryException
How to fix it?
Or try this: