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();
    }