public function deleteUserRegistrations(User $user, array $collections)
    {
        $qb = $this->repository->createQueryBuilder('d');
        $qb->delete('Phraseanet:Registration', 'd');
        $qb->where($qb->expr()->eq('d.user', ':user'));
        $qb->setParameter(':user', $user->getId());

        if (count($collections) > 0) {
            $qb->andWhere('d.baseId IN (:bases)');
            $qb->setParameter(':bases', array_map(function ($collection) {
                return $collection->get_base_id();
            }, $collections));
        }

        return $qb->getQuery()->execute();
    }
public function deleteUserRegistrations(User $user, array $collections)
    {
        $qb = $this->repository->createQueryBuilder('d');
        $qb->delete('Phraseanet:Registration', 'd');
        $qb->where($qb->expr()->eq('d.user', ':user'));
        $qb->setParameter(':user', $user->getId());

        if (count($collections) > 0) {
            $qb->andWhere('d.baseId IN (:bases)');
            $qb->setParameter(':bases', array_map(function ($collection) {
                return $collection->get_base_id();
            }, $collections));
        }

        return $qb->getQuery()->execute();
    }
public function deleteUserRegistrations ( User $ user , array $ collections ) { $ qb = $ this -> repository -> createQueryBuilder ( 'd' ) ; $ qb -> delete ( 'Phraseanet:Registration' , 'd' ) ; $ qb -> where ( $ qb -> expr ( ) -> eq ( 'd.user' , ':user' ) ) ; $ qb -> setParameter ( ':user' , $ user -> getId ( ) ) ; if ( count ( $ collections ) > 0 ) { $ qb -> andWhere ( 'd.baseId IN (:bases)' ) ; $ qb -> setParameter ( ':bases' , array_map ( function ( $ collection ) { return $ collection -> get_base_id ( ) ; } , $ collections ) ) ; } return $ qb -> getQuery ( ) -> execute ( ) ; }
Deletes registration for given user.

@param User          $user
@param \collection[] $collections

@return mixed
Deletes registration for given user .