I have class Task with categories array of integers property
class Task{
/**
* @var array
*
* @ORM\Column(name="categories", type="array", nullable=true)
*/
private $categories;
}
now in controller I am trying to build query which would check if category id variable is in categories array of the task
$qb = $this->getDoctrine()->getRepository('CoreBundle:Task')->createQueryBuilder('t');
$qb->where(':category IN (t.categories)')
->setParameter('category', $category);
This gives me error:
[Syntax Error] line 0, col 140: Error: Expected Literal, got "t";