src/DcSiteBundle/Controller/Peugeot/AboutController.php line 45

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\Peugeot;
  3. use CoreBundle\Entity\Post;
  4. use CoreBundle\Model\ViDiWorkerModel;
  5. use DcSiteBundle\Entity\SalesContract;
  6. use DcSiteBundle\Entity\TermsMaintenance;
  7. use DcSiteBundle\Entity\Vacancy;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  11. class AboutController extends BaseController
  12. {
  13.     public function about(): ?Response
  14.     {
  15.         return $this->basePeugeotRender('@DcSite/Peugeot/About/about-company.html.twig');
  16.     }
  17.     public function news(): ?Response
  18.     {
  19.         $news $this->em->getRepository(Post::class)->getNewsByDealer($this->getDealer());
  20.         return $this->basePeugeotRender('@DcSite/Peugeot/About/news.html.twig', ['news' => $news]);
  21.     }
  22.     public function newsSingle(\CoreBundle\Model\Post $postModel$url): ?Response
  23.     {
  24.         $post $postModel->initByUrl($this->getDealer(), $url);
  25.         return $this->basePeugeotRender('@DcSite/Peugeot/About/news-single.html.twig', [
  26.             'post' => $post,
  27.         ]);
  28.     }
  29.     public function qualityPolicy(): ?Response
  30.     {
  31.         return $this->basePeugeotRender('@DcSite/Peugeot/About/quality-policy.html.twig');
  32.     }
  33.     public function contacts(): ?Response
  34.     {
  35.         return $this->basePeugeotRender('@DcSite/Peugeot/About/contacts.html.twig');
  36.     }
  37.     public function conditionsSales(): ?Response
  38.     {
  39.         $filesByType $this->em->getRepository(SalesContract::class)->getFilesByTypes($this->getDealer());
  40.         return $this->basePeugeotRender('@DcSite/Peugeot/About/conditions-of-sales.html.twig', [
  41.             'filesByType' => $filesByType,
  42.         ]);
  43.     }
  44.     public function termsMaintenance(): ?Response
  45.     {
  46.         $files $this->em->getRepository(TermsMaintenance::class)->findBy(['dealer' => $this->getDealer()], ['begin_date' => 'ASC']);
  47.         return $this->basePeugeotRender('@DcSite/Peugeot/terms-maintenance.html.twig', [
  48.             'mainFile' => array_pop($files),
  49.             'files' => $files,
  50.             'dealer' => $this->getDealer(),
  51.         ]);
  52.     }
  53.     public function staff(Request $requestViDiWorkerModel $viDiWorkerModel): ?Response
  54.     {
  55.         $workers $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
  56.         return $this->basePeugeotRender('@DcSite/Peugeot/About/staff.html.twig', [
  57.             'workers' => $workers,
  58.         ]);
  59.     }
  60.     //    Вакансії
  61.     public function vacancy(): ?Response
  62.     {
  63.         $vacancies $this->em->getRepository(Vacancy::class)->getByDealer($this->getDealer());
  64.         return $this->basePeugeotRender('@DcSite/Peugeot/About/vacancy.html.twig', [
  65.             'vacancies' => $vacancies,
  66.         ]);
  67.     }
  68.     //    Вакансія ID
  69.     public function vacancyId($id): ?Response
  70.     {
  71.         $vacancy $this->em->getRepository(Vacancy::class)->getByID($id);
  72.         if (!$vacancy) {
  73.             throw new NotFoundHttpException();
  74.         }
  75.         return $this->basePeugeotRender('@DcSite/Peugeot/About/vacancy-id.html.twig', [
  76.             'vacancy' => $vacancy,
  77.             'vacancyForm' => $this->CoreFormFactory()->vacancyForm($this->getDealer(), $vacancy)->createView(),
  78.         ]);
  79.     }
  80.     public function publicOffer(): ?Response
  81.     {
  82.         return $this->basePeugeotRender('@DcSite/Peugeot/About/public-offer.html.twig', ['dealer' => $this->getDealer()]);
  83.     }
  84.     public function returnRefundPolicies(): ?Response
  85.     {
  86.         return $this->basePeugeotRender('@DcSite/Peugeot/About/return-refund-policies.html.twig');
  87.     }
  88. }