<?php
namespace App\Controller;
use App\Entity\Produit;
use App\Entity\Publicite;
use App\Entity\Service;
use App\Entity\Typenews;
use App\Entity\Video;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class BaseController extends AbstractController
{
/**
* Renders a view.
*
* @final
*/
protected function render(string $view, array $parameters = [], Response $response = null): Response
{
$doctrine=$this->getDoctrine();
$parameters['services'] = $doctrine->getRepository(Service::class)->findAll();
$parameters['publicites'] = $doctrine->getRepository(Publicite::class)->findAll();
$parameters['produits'] = $doctrine->getRepository(Produit::class)->findAll();
$parameters['videos'] = $doctrine->getRepository(Video::class)->findAll();
$parameters['typesnews'] = $doctrine->getRepository(Typenews::class)->findAll();
//dd($parameters);
if ($this->container->has('templating')) {
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
}
if (null === $response) {
$response = new Response();
}
$response->setContent($content);
return $response;
}
/* private function initData()
{
$doctrine=$this->getDoctrine();
$this->base_service=$doctrine->getRepository(Service::class)->findAll();
$this->base_publicite = $doctrine->getRepository(Publicite::class)->findAll();
$this->base_produit = $doctrine->getRepository(Produit::class)->findAll();
$this->base_video = $doctrine->getRepository(Video::class)->findAll();
$this->base_typenews = $doctrine->getRepository(Typenews::class)->findAll();
}*/
}