src/Controller/MainController.php line 41
<?php
namespace App\Controller;
use App\Entity\Parcours;
use App\Entity\SkillCategory;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
{
private EntityManagerInterface $entityManager;
private string $title;
private string $meta_description;
private string $og_title;
private string $og_description;
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
$this->title = 'Antony Martin';
$this->meta_description = 'Portfolio Antony Martin, Compétences et Parcours de mon expérience';
$this->og_title = $this->title;
$this->og_description = $this->meta_description;
}
#[Route('/', name: 'homepage')]
public function index(): Response
{
return $this->render('main/index.html.twig', [
'controller_name' => 'MainController',
'title' => $this->title,
'meta_description' => $this->meta_description,
'og_title' => $this->og_title,
'og_description' => $this->og_description,
]);
}
#[Route('/parcours', name: 'parcours')]
public function parcours(): Response
{
$parcours = $this->entityManager->getRepository(Parcours::class)->findBy([], ['date_debut' => 'DESC']);
$this->title = 'Mon Parcourt | Antony Martin';
return $this->render('main/parcours.html.twig', [
'controller_name' => 'MainController',
'h1' => 'Mon Parcourt',
'parcours' => $parcours,
'title' => $this->title,
'meta_description' => $this->meta_description,
'og_title' => $this->og_title,
'og_description' => $this->og_description,
]);
}
#[Route('/skills', name: 'skills')]
public function skills(): Response
{
$categories = $this->entityManager->getRepository(SkillCategory::class)->findAll();
$this->title = 'Mes Compétences | Antony Martin' ;
return $this->render('main/skills.html.twig', [
'controller_name' => 'MainController',
'h1' => 'Mes Compétences',
'title' => $this->title,
'meta_description' => $this->meta_description,
'og_title' => $this->og_title,
'og_description' => $this->og_description,
'categories' => $categories
]);
}
}