src/Controller/DefaultController.php line 44

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Order;
  4. use App\Service\DomainManager;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Psr\Log\LoggerInterface;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. use Symfony\Component\HttpFoundation\Request;
  12. class  DefaultController extends AbstractController
  13. {
  14.     private $logger;
  15.     private $domainManager;
  16.     private $em;
  17.     public function __construct(LoggerInterface $loggerCommandDomainManager $domainManagerEntityManagerInterface $em)
  18.     {
  19.         $this->domainManager $domainManager;
  20.         $this->logger $loggerCommand;
  21.         $this->em $em;
  22.     }
  23.     /**
  24.      * @Route("/{_locale}/test", name="test")
  25.      */
  26.     public function test(Request $request)
  27.     {
  28.         return $this->render('@App\test.html.twig');
  29.     }
  30.     /**
  31.      * @param Request $request
  32.      * @return Response
  33.      * @Route("/", name="index")
  34.      */
  35.     public function index(Request $request)
  36.     {
  37.         $domain $this->domainManager->getCurrentDomain();
  38.         if (!$domain) {
  39.             throw new NotFoundHttpException();
  40.         }
  41.         return $this->render('@App\index.html.twig', ['domain' => $domain]);
  42.     }
  43. }