vendor/simpledot/cms-bundle/AWCmsBundle/Controller/HealthCheckController.php line 28

Open in your IDE?
  1. <?php
  2. namespace AWCmsBundle\Controller;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use AWCmsBundle\Entity\Site;
  8. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  9. /**
  10.  * Class HealthCheckController
  11.  *
  12.  * @package AWCmsBundle\Controller
  13.  * @author  David Courtey
  14.  */
  15. class HealthCheckController extends AbstractController
  16. {
  17.     
  18.     /**
  19.      * @Route("/healthcheck", name="awcms_healthcheck", options={"i18n"=false})
  20.      * @param EntityManagerInterface $entityManager
  21.      * @param SessionInterface $session
  22.      * @return Response
  23.      * @throws \Exception
  24.      */
  25.     public function healthCheckAction(EntityManagerInterface $entityManagerSessionInterface $session)
  26.     {
  27.         $entityManager->getRepository(Site::class)->findAll();
  28.         $session->set('healthcheck_tester''foo');
  29.         if($session->get('healthcheck_tester') != 'foo'){
  30.             throw new \Exception('Session test fail');
  31.         }
  32.         return new Response('ok '.disk_free_space("/"));
  33.     }
  34.     
  35.     /**
  36.      * @Route("/exception", name="awcms_exception", options={"i18n"=false})
  37.      * @throws \Exception
  38.      */
  39.     public function exceptionAction()
  40.     {
  41.         throw new \Exception('Exception tester');
  42.     }
  43. }