<?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 ContactController extends AbstractController {
public function __construct() {
// echo 'We can use __contruct<br />';
}
/**
* @Route(
* {
* "es" : "{_locale}/contacta",
* "ca" : "{_locale}/contacta",
* "en" : "{_locale}/contact",
* }, name="contact",
* requirements={
* "_locale": "es|ca|en",
* "_format" : "html"
* }
* )
*/
public function index(Request $request, TextHelper $textHelper) {
$oneSection = $this->getDoctrine()->getRepository(Section::Class)->findOneBy(['code' => 'contact']);
$text = ($textHelper->getBySection($oneSection)) ? $textHelper->getBySection($oneSection) : [];
return $this->render('Frontend/contact/contact.html.twig', ['text' => $text, 'oneSection' => $oneSection]);
}
}