/**
  * Retrieves Site with id $id or throws an exception if it doesn't exist
  *
  * @param $id
  *
  * @return SiteInterface
  *
  * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  */
 protected function getSite($id)
 {
     $site = $this->siteManager->findOneBy(array('id' => $id));
     if (null === $site) {
         throw new NotFoundHttpException(sprintf('Site (%d) not found', $id));
     }
     return $site;
 }
 /**
  * @return SiteInterface|bool
  *
  * @throws \RuntimeException
  */
 public function getSite()
 {
     if (!$this->hasRequest()) {
         return false;
     }
     $siteId = null;
     if ($this->getRequest()->getMethod() == 'POST') {
         $values = $this->getRequest()->get($this->getUniqid());
         $siteId = isset($values['site']) ? $values['site'] : null;
     }
     $siteId = null !== $siteId ? $siteId : $this->getRequest()->get('siteId');
     if ($siteId) {
         $site = $this->siteManager->findOneBy(array('id' => $siteId));
         if (!$site) {
             throw new \RuntimeException('Unable to find the site with id=' . $this->getRequest()->get('siteId'));
         }
         return $site;
     }
     return false;
 }