src/Controller/HomeController.php line 48

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ReviewFormRepository;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\JsonResponse;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\BinaryFileResponse;
  8. use Symfony\Component\HttpFoundation\StreamedResponse;
  9. use Symfony\Component\HttpFoundation\Request;
  10. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use App\Repository\UsersRepository;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use DateTime;
  15. use App\Repository\QuestionRepository;
  16. use App\Repository\DimensionRepository;
  17. use App\Entity\Users;
  18. class HomeController extends AbstractController
  19. {
  20.     public function __construct(
  21.         QuestionRepository $questionRepository,
  22.         DimensionRepository $dimensionRepository,
  23.         ReviewFormRepository $reviewFormRepository
  24.     )
  25.     {
  26.         $this->questionRepository $questionRepository;
  27.         $this->dimensionRepository $dimensionRepository;
  28.         $this->reviewFormRepository $reviewFormRepository;
  29.     }
  30.     #[Route(path'/'name'index')]
  31.     public function index(): Response
  32.     {
  33.         return $this->redirectToRoute('form', [
  34.             'lang' => 'fr',
  35.             'formId' => '8b6cf598-7f27-11ef-9d7f-1d1f43f3f908'
  36.         ]);
  37.     }
  38.     #[Route(path'/form/{lang}/{formId}'name'form')]
  39.     public function form($lang$formId): Response
  40.     {
  41.         $reviewForm $this->reviewFormRepository->findFormWithDimensionsAndQuestionsByLang($formId$lang);
  42.         return $this->render('index.html.twig', [
  43.             'reviewForm' => $reviewForm
  44.         ]);
  45.     }
  46. }