We have two options for where not in clause.


Example 1


....
  ->createQuery('e')
  ->whereNotIn('e.id', [1, 2, 3 .....]))
  ->
.....;

Example 2


$qb = $this->createQueryBuilder('e');

$qp
->select('e')
->where($qb->expr()->notIn('e.id', [1, 2, 3 .....]))
->getQuery()
->getResult();