<?php
namespace AutomarketBundle\Controller;
use CoreBundle\Component\CoreFormFactory;
use CoreBundle\Model\ViDiWorkerModel;
use DcSiteBundle\Entity\Vacancy;
use Doctrine\ORM\EntityManagerInterface;
use PortalBundle\Model\SeoMetaTag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class AboutController extends BaseController
{
public function __construct(CoreFormFactory $coreFormFactory, RequestStack $requestStack, EntityManagerInterface $em, SeoMetaTag $seoMetaTag)
{
parent::__construct($coreFormFactory, $requestStack, $em, $seoMetaTag);
}
public function staff(Request $request, ViDiWorkerModel $viDiWorkerModel): Response
{
$staff = $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
return $this->baseAutomarketRender('@Automarket/AboutCompany/staff.html.twig', ['staff' => $staff]);
}
public function aboutAutomarket(Request $request, ViDiWorkerModel $viDiWorkerModel): Response
{
$workers = $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
return $this->baseAutomarketRender('@Automarket/AboutCompany/about.html.twig', ['workers' => $workers]);
}
public function qualityPolicy(): Response
{
return $this->baseAutomarketRender('@Automarket/AboutCompany/quality-policy.html.twig', [
'dealer' => $this->getDealer(),
]);
}
// Вакансії
public function vacancy(EntityManagerInterface $em): Response
{
$vacancies = $em->getRepository(Vacancy::class)->getByDealer($this->getDealer());
return $this->baseAutomarketRender('@Automarket/AboutCompany/vacancy.html.twig', [
'vacancies' => $vacancies,
]);
}
// Вакансія ID
public function vacancyId($id, EntityManagerInterface $em): Response
{
$vacancy = $em->getRepository(Vacancy::class)->getByID($id);
if (!$vacancy) {
throw new NotFoundHttpException();
}
return $this->baseAutomarketRender('@Automarket/AboutCompany/vacancy-id.html.twig', [
'vacancy' => $vacancy,
'vacancyForm' => $this->get('core.form.factory')->vacancyForm($this->getDealer(), $vacancy)->createView(),
]);
}
}