public function removeByIds(array $in = [], array $notIn = [])
    {
        if (!count($in) && !count($notIn)) {
            return;
        }

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

        if ($this->getClassMetadata()->hasField('deletedAt')) {
            $qb->update()
                ->set('e.deletedAt', ':date')
                ->setParameter('date', new DateTimeImmutable())
            ;
        } else {
            $qb->delete();
        }

        if (count($in)) {
            $qb->andWhere($qb->expr()->in('e.id', ':inIds'));
            $qb->setParameter('inIds', $in);
        }

        if (count($notIn)) {
            $qb->andWhere($qb->expr()->notIn('e.id', ':notInIds'));
            $qb->setParameter('notInIds', $notIn);
        }

        $qb->getQuery()->execute();
    }
public function removeByIds(array $in = [], array $notIn = [])
    {
        if (!count($in) && !count($notIn)) {
            return;
        }

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

        if ($this->getClassMetadata()->hasField('deletedAt')) {
            $qb->update()
                ->set('e.deletedAt', ':date')
                ->setParameter('date', new DateTimeImmutable())
            ;
        } else {
            $qb->delete();
        }

        if (count($in)) {
            $qb->andWhere($qb->expr()->in('e.id', ':inIds'));
            $qb->setParameter('inIds', $in);
        }

        if (count($notIn)) {
            $qb->andWhere($qb->expr()->notIn('e.id', ':notInIds'));
            $qb->setParameter('notInIds', $notIn);
        }

        $qb->getQuery()->execute();
    }
public function removeByIds ( array $ in = [ ] , array $ notIn = [ ] ) { if ( ! count ( $ in ) && ! count ( $ notIn ) ) { return ; } $ qb = $ this -> createQueryBuilder ( 'e' ) ; if ( $ this -> getClassMetadata ( ) -> hasField ( 'deletedAt' ) ) { $ qb -> update ( ) -> set ( 'e.deletedAt' , ':date' ) -> setParameter ( 'date' , new DateTimeImmutable ( ) ) ; } else { $ qb -> delete ( ) ; } if ( count ( $ in ) ) { $ qb -> andWhere ( $ qb -> expr ( ) -> in ( 'e.id' , ':inIds' ) ) ; $ qb -> setParameter ( 'inIds' , $ in ) ; } if ( count ( $ notIn ) ) { $ qb -> andWhere ( $ qb -> expr ( ) -> notIn ( 'e.id' , ':notInIds' ) ) ; $ qb -> setParameter ( 'notInIds' , $ notIn ) ; } $ qb -> getQuery ( ) -> execute ( ) ; }
Will remove entities based on the ids you input.

@param int[] $in
@param int[] $notIn
Will remove entities based on the ids you input .