getMaxRepeat(); $count = $this->createQueryBuilder('a') ->select('COUNT(a)') ->where('a.itemId = :itemId') ->andWhere('a.userId = :userId') ->setParameters( array( 'itemId' => $item->getId(), 'userId' => $user->getUserId() ) ) ->getQuery() ->getSingleScalarResult(); return $count <= $max ? true : false; } }