src/Controller/HomeController.php line 99

  1. <?php
  2. namespace App\Controller;
  3. use App\Form\ContactType;
  4. use App\Repository\CompanyRepository;
  5. use App\Repository\ExperienceRepository;
  6. use App\Repository\FormationRepository;
  7. use App\Repository\InterestRepository;
  8. use App\Repository\MeRepository;
  9. use App\Repository\ProjectRepository;
  10. use App\Repository\SkillsRepository;
  11. use App\Service\ContactHandle;
  12. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\HttpFoundation\Response;
  15. use Symfony\Component\Routing\Annotation\Route;
  16. class HomeController extends AbstractController
  17. {
  18. //    #[Route('/me', name: 'app_me_v0')]
  19. //    public function mepagev0(MeRepository $meRepository, InterestRepository $interestRepository,
  20. //                          SkillsRepository $skillsRepository, ExperienceRepository $experienceRepository,
  21. //                          FormationRepository $formationRepository, ProjectRepository $projectRepository):
  22. //    Response
  23. //    {
  24. //        return $this->render('home/me.html.twig', [
  25. //            'me' => $meRepository->findOneBy(['id'=>1]),
  26. //            'interests' => $interestRepository->findAll(),
  27. //            'softs' => $skillsRepository->findBy(['type' => 'soft']),
  28. //            'technos' => $skillsRepository->findBy(['type' => 'language']),
  29. //            'softwares' => $skillsRepository->findBy(['type' => 'software']),
  30. //            'experiences' => $experienceRepository->findAll(),
  31. //            'formations' => $formationRepository->findAll(),
  32. //            'projects' => $projectRepository->sortedStartedAt(),
  33. //        ]);
  34. //    }
  35.     #[Route('/contact'name'app_contact')]
  36.     public function contact(Request $requestCompanyRepository $companyRepositoryContactHandle $contactHandle):
  37.     Response
  38.     {
  39.         $form $this->createForm(ContactType::class);
  40.         $form->handleRequest($request);
  41.         if ($form->isSubmitted() && $form->isValid()){
  42.             $contactHandle->discordMessage($form);
  43.             $this->addFlash('success''message envoyé avec succès !');
  44.             return $this->redirectToRoute('app_contact');
  45.         }
  46.         return $this->render('home/contact.html.twig',[
  47.             'company' => $companyRepository->findOneBy(['id' =>1]),
  48.             'form' => $form,
  49.             'page' => 'contact'
  50.         ]);
  51.     }
  52.     #[Route('/github'name'github')]
  53.     public function github(CompanyRepository $companyRepository):
  54.     Response
  55.     {
  56.         return $this->redirect($_ENV['URL_GITHUB']);
  57.     }
  58.     #[Route('/linkedin'name'linkedin')]
  59.     public function linkedin(CompanyRepository $companyRepository):
  60.     Response
  61.     {
  62.         return $this->redirect($_ENV['URL_LINKEDIN']);
  63.     }
  64.     #[Route('/instagram'name'instagram')]
  65.     public function instagram(CompanyRepository $companyRepository):
  66.     Response
  67.     {
  68.         return $this->redirect($_ENV['URL_INSTAGRAM']);
  69.     }
  70.     #[Route('/discord'name'discord')]
  71.     public function discord(CompanyRepository $companyRepository):
  72.     Response
  73.     {
  74.         return $this->redirect($_ENV['URL_DISCORD']);
  75.     }
  76.     #[Route('/twitch'name'twitch')]
  77.     public function twitch(CompanyRepository $companyRepository):
  78.     Response
  79.     {
  80.         return $this->redirect($_ENV['URL_TWITCH']);
  81.     }
  82.     #[Route('/{reactRouting}'name'app'requirements: ['reactRouting' => '.+'], defaults: ['reactRouting' => null])]
  83.     public function index(CompanyRepository $companyRepository):
  84.     Response
  85.     {
  86.         return $this->render('react/reactMicro.html.twig',[
  87.         ]);
  88.     }
  89. }