public function flush(PersistableInterface $persistable, $forget = true)
    {
        if ($forget)
        {
            $this->forget();
        }

        $code = $this->check();

        $entityManager = $this->getEntityManager();
        $queryBuilder = $entityManager->createQueryBuilder();

        $queryBuilder
            ->delete($this->entityName(), 'p')
            ->where('p.user = :persistable')
            ->andWhere('p.code != :code');

        $queryBuilder->setParameters([
            'persistable' => $persistable,
            'code'        => $code
        ]);

        $queryBuilder->getQuery()->execute();
    }
public function flush(PersistableInterface $persistable, $forget = true)
    {
        if ($forget)
        {
            $this->forget();
        }

        $code = $this->check();

        $entityManager = $this->getEntityManager();
        $queryBuilder = $entityManager->createQueryBuilder();

        $queryBuilder
            ->delete($this->entityName(), 'p')
            ->where('p.user = :persistable')
            ->andWhere('p.code != :code');

        $queryBuilder->setParameters([
            'persistable' => $persistable,
            'code'        => $code
        ]);

        $queryBuilder->getQuery()->execute();
    }
public function flush ( PersistableInterface $ persistable , $ forget = true ) { if ( $ forget ) { $ this -> forget ( ) ; } $ code = $ this -> check ( ) ; $ entityManager = $ this -> getEntityManager ( ) ; $ queryBuilder = $ entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> delete ( $ this -> entityName ( ) , 'p' ) -> where ( 'p.user = :persistable' ) -> andWhere ( 'p.code != :code' ) ; $ queryBuilder -> setParameters ( [ 'persistable' => $ persistable , 'code' => $ code ] ) ; $ queryBuilder -> getQuery ( ) -> execute ( ) ; }
Flushes persistences for the given user.

@param  PersistableInterface $persistable
@param  bool                 $forget

@return void
Flushes persistences for the given user .