/**
  * @param string          $attribute
  * @param Ticket $object
  * @param null            $user
  *
  * @return bool
  */
 protected function isGranted($attribute, $object, $user = null)
 {
     if (!$user instanceof UserInterface) {
         return false;
     }
     if ($attribute === 'REGISTRATION_OPEN') {
         if ($object->isPublic() === false) {
             return false;
         }
         $now = new \DateTime('today');
         if ($now < $object->getStartDate() || $now > $object->getEndDate()) {
             return false;
         }
         return true;
     }
     $convention = $object->getConvention();
     $seats = $this->repository->countSeats($convention, $user);
     if ($object->isReduced()) {
         if ($seats < $convention->getReducedSeats()) {
             return true;
         }
     } else {
         if ($seats < $convention->getSeats()) {
             return true;
         }
     }
     return false;
 }