src/Kunstmaan/AdminListBundle/Repository/EntityVersionLockRepository.php
public function getLocksForLockableEntity(LockableEntity $entity, $threshold, User $userToExclude = null)
    {
        $qb = $this->createQueryBuilder('evl')
            ->select('evl')
            ->join('evl.lockableEntity', 'le')
            ->where('le.id = :e')
            ->andWhere('evl.createdAt > :date')
            ->setParameter('e', $entity->getId())
            ->setParameter('date', new \DateTime(sprintf('-%s seconds', $threshold)))
        ;

        if (!is_null($userToExclude)) {
            $qb->andWhere('evl.owner <> :owner')
                ->setParameter('owner', $userToExclude->getUsername())
            ;
        }

        return $qb->getQuery()->getResult();
    }
public function getLocksForLockableEntity(LockableEntity $entity, $threshold, User $userToExclude = null)
    {
        $qb = $this->createQueryBuilder('evl')
            ->select('evl')
            ->join('evl.lockableEntity', 'le')
            ->where('le.id = :e')
            ->andWhere('evl.createdAt > :date')
            ->setParameter('e', $entity->getId())
            ->setParameter('date', new \DateTime(sprintf('-%s seconds', $threshold)))
        ;

        if (!is_null($userToExclude)) {
            $qb->andWhere('evl.owner <> :owner')
                ->setParameter('owner', $userToExclude->getUsername())
            ;
        }

        return $qb->getQuery()->getResult();
    }
public function getLocksForLockableEntity ( LockableEntity $ entity , $ threshold , User $ userToExclude = null ) { $ qb = $ this -> createQueryBuilder ( 'evl' ) -> select ( 'evl' ) -> join ( 'evl.lockableEntity' , 'le' ) -> where ( 'le.id = :e' ) -> andWhere ( 'evl.createdAt > :date' ) -> setParameter ( 'e' , $ entity -> getId ( ) ) -> setParameter ( 'date' , new \ DateTime ( sprintf ( '-%s seconds' , $ threshold ) ) ) ; if ( ! is_null ( $ userToExclude ) ) { $ qb -> andWhere ( 'evl.owner <> :owner' ) -> setParameter ( 'owner' , $ userToExclude -> getUsername ( ) ) ; } return $ qb -> getQuery ( ) -> getResult ( ) ; }
Check if there is a entity lock that's not passed the threshold.

@param LockableEntity $entity
@param int            $threshold
@param User           $userToExclude

@return EntityVersionLock[]
Check if there is a entity lock that s not passed the threshold .