<?php
namespace FoundersBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use FoundersBundle\Entity\Biography;
use FoundersBundle\Entity\CategoryPost;
use FoundersBundle\Model\Post;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class BaseController extends AbstractController
{
protected EntityManagerInterface $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
protected function baseFounderController($view, array $parameters = [], Response $response = null): Response
{
$investmentCategory = $this->em->getRepository(CategoryPost::class)->findBy(['state' => true]);
$biographies = $this->em->getRepository(Biography::class)->findAll();
$parameters = array_merge($parameters, [
'postTypeSocialInvestment' => Post::POST_TYPE_SOCIAL_INVESTMENT,
'investmentCategory' => $investmentCategory,
'biographies' => $biographies,
]);
if (null === $response) {
$response = new Response();
}
return parent::render($view, $parameters, $response);
}
}