<?php
namespace App\Controller;
use App\Entity\Order;
use App\Service\DomainManager;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends AbstractController
{
private $logger;
private $domainManager;
private $em;
public function __construct(LoggerInterface $loggerCommand, DomainManager $domainManager, EntityManagerInterface $em)
{
$this->domainManager = $domainManager;
$this->logger = $loggerCommand;
$this->em = $em;
}
/**
* @Route("/{_locale}/test", name="test")
*/
public function test(Request $request)
{
return $this->render('@App\test.html.twig');
}
/**
* @param Request $request
* @return Response
* @Route("/", name="index")
*/
public function index(Request $request)
{
$domain = $this->domainManager->getCurrentDomain();
if (!$domain) {
throw new NotFoundHttpException();
}
return $this->render('@App\index.html.twig', ['domain' => $domain]);
}
}