If you want to use the MySQL command IN()
in the QueryBuilder, you can do it with the in()
function of the ExpressionBuilder class.
// get an ExpressionBuilder instance, so that you
$expressionBulder = $this->_em->getExpressionBuilder();
$qb = $this->_em->createQueryBuilder()
->select('p')
->from($this->_entityName, 'p');
->where($expressionBuilder->in('p.id', array(1,2,3,4,5)));
return $qb->getQuery()->getResult();