src/Controller/Frontend/ExperienceController.php line 34

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Doctrine\ORM\EntityManagerInterface;
  9. use App\Service\TextHelper;
  10. use App\Entity\Section;
  11. class ExperienceController extends AbstractController
  12. {
  13.    public function __construct()
  14.    {
  15.       // echo 'We can use __contruct<br />';
  16.    }
  17.     /**
  18.      * @Route(
  19.      *   {
  20.      *       "es" : "{_locale}/experiencia",
  21.      *       "ca" : "{_locale}/experiencia",
  22.      *       "en" : "{_locale}/experience",
  23.      *    }, name="experience",
  24.      *       requirements={
  25.      *          "_locale": "es|ca|en",
  26.      *          "_format" : "html"
  27.      *      }
  28.      * )
  29.      */
  30.    public function index(Request $requestTextHelper $textHelper)
  31.    {
  32.        $oneSection $this->getDoctrine()->getRepository(Section::Class)->findOneBy(['code' => 'experience']);
  33.         $text = ($textHelper->getBySection($oneSection)) ? $textHelper->getBySection($oneSection) : [];
  34.      return $this->render('Frontend/experience/experience.html.twig',['text' => $text'oneSection' => $oneSection]);
  35.    }
  36. }