src/Controller/BaseController.php line 47
<?php
namespace App\Controller;
use App\Entity\Contact;
use App\Form\ContactType;
use App\Notification\ContactNotification;
use App\Service\CallApiFacebook;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BaseController extends AbstractController
{
#[Route('/', name: 'app_index')]
public function index(Request $request, ContactNotification $notification, CallApiFacebook $callApiFacebook): Response
{
$contact = new Contact();
$form = $this->createForm(ContactType::class, $contact);
$form->handleRequest($request);
if($form->isSubmitted() && $form->isValid()){
$notification->notify($contact);
$this->addFlash('success', 'Votre email a bien été envoyé.');
}
return $this->render('pages/index.html.twig', [
'form' => $form,
'data' => $callApiFacebook->getAllData()
]);
}
#[Route('/mentions-legales', name: 'app_mention')]
public function mentions(): Response
{
return $this->render('pages/mentions.html.twig');
}
#[Route('/politique-de-confidentialite', name: 'app_rgpd')]
public function rgpd(): Response
{
return $this->render('pages/rgpd.html.twig');
}
#[Route('/faq', name: 'app_faq')]
public function faq(): Response
{
return $this->render('pages/faq.html.twig');
}
}