0

I have an array of category, how to use IN statement in where class using Doctrine?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user2812049
  • 31
  • 1
  • 3
  • 1
    This question has already an answer [here](http://stackoverflow.com/a/6319643/1607098) – Touki Oct 07 '13 at 13:01

1 Answers1

-1

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;
                }

}