I have an array of category, how to use IN statement in where class using Doctrine?
You can use like this
public function searchCategory($target){//$target is an aray(1,2,3)
$query = $this->getEntityManager()
->createQuery("SELECT abc ct.target as target FROM AdminBundle:ClothingType ct WHERE ct.target IN (:target)")
->setParameter('target',$target['target']);// You can change it as ur requirment
try {
return $query->getResult();
} catch (\Doctrine\ORM\NoResultException $e) {
return null;
}
}