<?php
namespace App\Controller;
use App\Repository\ReviewFormRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Routing\Annotation\Route;
use App\Repository\UsersRepository;
use Doctrine\ORM\EntityManagerInterface;
use DateTime;
use App\Repository\QuestionRepository;
use App\Repository\DimensionRepository;
use App\Entity\Users;
class HomeController extends AbstractController
{
public function __construct(
QuestionRepository $questionRepository,
DimensionRepository $dimensionRepository,
ReviewFormRepository $reviewFormRepository
)
{
$this->questionRepository = $questionRepository;
$this->dimensionRepository = $dimensionRepository;
$this->reviewFormRepository = $reviewFormRepository;
}
#[Route(path: '/', name: 'index')]
public function index(): Response
{
return $this->redirectToRoute('form', [
'lang' => 'fr',
'formId' => '8b6cf598-7f27-11ef-9d7f-1d1f43f3f908'
]);
}
#[Route(path: '/form/{lang}/{formId}', name: 'form')]
public function form($lang, $formId): Response
{
$reviewForm = $this->reviewFormRepository->findFormWithDimensionsAndQuestionsByLang($formId, $lang);
return $this->render('index.html.twig', [
'reviewForm' => $reviewForm
]);
}
}