/**
  * Perform a single access check operation on a given attribute, object and (optionally) user
  * It is safe to assume that $attribute and $object's class pass supportsAttribute/supportsClass
  * $user can be one of the following:
  *   a UserInterface object (fully authenticated user)
  *   a string               (anonymously authenticated user)
  *
  * @param string $attribute
  * @param Conference $object
  * @param UserInterface|string $user
  *
  * @return bool
  */
 protected function isGranted($attribute, $object, $user = null)
 {
     if (!$object instanceof Conference) {
         $object = $object->getConference();
     }
     if ($object->getId() == $this->cm->getConference()->getId()) {
         return true;
     }
     return false;
 }
 public function onKernelRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $currentHost = $request->getHost();
     $subdomain = str_replace('.' . $this->baseHost, '', $currentHost);
     if ("www" === $subdomain) {
         return;
     }
     $conference = $this->om->getRepository('AppBundle:Conference')->findOneBy(array('code' => $subdomain));
     if (!$conference) {
         throw new NotFoundHttpException(sprintf('No site for host "%s", subdomain "%s"', $this->baseHost, $subdomain));
     }
     $this->cm->setConference($conference);
 }