コード例 #1
0
 public function aceExists(User $user, OwnableInterface $entity)
 {
     $qb = $this->createQueryBuilder('e');
     $query = $qb->select('COUNT(e.id) AS c')->where('e.userId = :uid')->andWhere('e.entityId = :entityId')->andWhere('e.revokedBy IS NULL')->andWhere('e.type = :type')->setParameter('entityId', $entity->getId())->setParameter('type', $entity->getAceType())->setParameter('uid', $user->getId());
     $res = $query->getQuery()->getOneOrNullResult();
     return $res['c'] > 0;
 }