<?php
namespace App\Controller;
use App\Form\ContactFormType;
use App\Repository\DentisteRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Component\Routing\Annotation\Route;
use App\Entity\Contact;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\BrowserKit\Request as BrowserKitRequest;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Loader\Configurator\mailer;
use Symfony\Component\HttpFoundation\Request as HttpFoundationRequest;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
class HomeController extends AbstractController
{
private $dentistesRepository;
public function __construct(DentisteRepository $dentisteRepository)
{
$this->dentistesRepository = $dentisteRepository;
}
#[Route('/', name: 'app_home')]
public function index(): Response
{
$dentistes = $this->dentistesRepository->findAll();
return $this->render('home/index.html.twig', [
'dentistes' => $dentistes,
'controller_name' => 'HomeController',
]);
}
#[Route('/blog', name: 'app_blog')]
public function blog(): Response
{
$dentistes = $this->dentistesRepository->findAll();
return $this->render('home/blog.html.twig', [
'dentistes' => $dentistes,
'controller_name' => 'HomeController',
]);
}
#[Route('/quisommesnous', name: 'app_quisommesnous')]
public function quisommesnous(): Response
{
return $this->render('home/quisommesnous.html.twig', [
'controller_name' => 'HomeController',
]);
}
#[Route('/videos', name: 'app_videos')]
public function videos(): Response
{
return $this->render('home/videos.html.twig', [
'controller_name' => 'HomeController',
]);
}
#[Route('/service', name: 'app_service')]
public function service(): Response
{
return $this->render('services/service.html.twig', [
'controller_name' => 'HomeController',
]);
}
#[Route('/urgencedentaire', name: 'app_urgencedentaire')]
public function urgencedentaire(): Response
{
return $this->render('services/urgencedentaire.html.twig', [
'controller_name' => 'HomeController',
]);
}
// #[Route('/contactt', name: 'contactt')]
// public function contact(Request $request,MailerInterface $mailer): Response
// {
// $form = $this->createForm(ContactFormType::class);
// $form->handleRequest($request);
// if ($form->isSubmitted() && $form->isValid()) {
// $formData = $form->getData();
// // dd($formData);
// $email = (new Email())
// ->from('contact@ksdental.ma')
// ->to('ayoubelkalali@gmail.com')
// //->cc('cc@example.com')
// //->bcc('bcc@example.com')
// //->replyTo('fabien@example.com')
// //->priority(Email::PRIORITY_HIGH)
// ->subject('Time for Symfony Mailer!')
// ->text('Sending emails is fun again!')
// ->html('<p>See Twig integration for better HTML integration!</p>');
// $mailer->send($email);
// $this->addFlash('success', 'Message sent!');
// }
// // dd($formData);
// return $this->render('home/contact.html.twig', [
// 'form' => $form->createView(),
// ]);
// }
// #[Route('/sendEmail', name: 'sendEmail')]
// public function sendEmail(Request $request,MailerInterface $mailer): Response
// {
// $email = (new Email())
// ->from('contact@ksdental.ma')
// ->to('ayoubelkalali@gmail.com')
// //->cc('cc@example.com')
// //->bcc('bcc@example.com')
// //->replyTo('fabien@example.com')
// //->priority(Email::PRIORITY_HIGH)
// ->subject('Time for Symfony Mailer!')
// ->text('Sending emails is fun again!')
// ->html('<p>See Twig integration for better HTML integration!</p>');
// $mailer->send($email);
// $this->addFlash('success', 'Message sent!');
// return $this->render('home/contact.html.twig', [
// 'controller_name' => 'HomeController',
// ]);
// }
}