<?php
namespace App\Controller\Frontend;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Doctrine\ORM\EntityManagerInterface;
use App\Service\TextHelper;
use App\Entity\Section;
class ExperienceController extends AbstractController
{
public function __construct()
{
// echo 'We can use __contruct<br />';
}
/**
* @Route(
* {
* "es" : "{_locale}/experiencia",
* "ca" : "{_locale}/experiencia",
* "en" : "{_locale}/experience",
* }, name="experience",
* requirements={
* "_locale": "es|ca|en",
* "_format" : "html"
* }
* )
*/
public function index(Request $request, TextHelper $textHelper)
{
$oneSection = $this->getDoctrine()->getRepository(Section::Class)->findOneBy(['code' => 'experience']);
$text = ($textHelper->getBySection($oneSection)) ? $textHelper->getBySection($oneSection) : [];
return $this->render('Frontend/experience/experience.html.twig',['text' => $text, 'oneSection' => $oneSection]);
}
}