<?php

namespace App\Controller\Frontend;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Entity\Site\Page;

class DefaultController extends AbstractController
{
    protected $em;

    public function __construct(EntityManagerInterface $em)
    {
        $this->em = $em;
    }

    public function home()
    {
        return $this->render('frontend/home.html.twig');
    }

    public function mention(): Response
    {
        $pageRepository = $this->em->getRepository(Page::class);

        return $this->render('page/page.html.twig', [
            'controller_name' => 'IndexController',
            'page' => $pageRepository->findOneByDevAlias('legal-mention')
        ]);
    }

}