src/DcSiteBundle/Controller/ToyotaBorispol/AboutController.php line 126

Open in your IDE?
  1. <?php
  2. namespace DcSiteBundle\Controller\ToyotaBorispol;
  3. use CoreBundle\Component\CoreFormFactory;
  4. use CoreBundle\Component\FormManager;
  5. use CoreBundle\Entity\ViDiDepartment;
  6. use CoreBundle\Factory\Vehicle as VehicleFactory;
  7. use CoreBundle\Model\Api\OnlineService\ApiServer1C;
  8. use CoreBundle\Model\Post;
  9. use CoreBundle\Model\Vehicles\Repository;
  10. use CoreBundle\Model\ViDiWorkerModel;
  11. use CoreBundle\Services\MediaExtensionVidi;
  12. use DcSiteBundle\Entity\Vacancy;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use PortalBundle\Model\SeoMetaTag;
  15. use Symfony\Component\Filesystem\Filesystem;
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\HttpFoundation\RequestStack;
  18. use Symfony\Component\HttpFoundation\Response;
  19. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  20. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  21. use Symfony\Component\Routing\RouterInterface;
  22. use Twig\Environment;
  23. class AboutController extends BaseController
  24. {
  25.     public function __construct(CoreFormFactory $coreFormFactorySeoMetaTag $seoMetaTagRequestStack $requestStackRouterInterface $routerFormManager $formManagerEntityManagerInterface $emApiServer1C $apiServer1CSessionInterface $sessionFilesystem $filesystemMediaExtensionVidi $mediaExtensionVidiRepository $vehicleRepositoryVehicleFactory $vehicleFactoryEnvironment $twig)
  26.     {
  27.         parent::__construct($coreFormFactory$seoMetaTag$requestStack$router$formManager$em$apiServer1C$session$filesystem$mediaExtensionVidi$vehicleRepository$vehicleFactory$twig);
  28.     }
  29.     public function about(): ?Response
  30.     {
  31.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/about-us.html.twig', [
  32.         ]);
  33.     }
  34.     public function contact(): ?Response
  35.     {
  36.         $departments $this->em->getRepository(ViDiDepartment::class)->findBy(['dealer' => $this->getDealer()]);
  37.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/contact.html.twig', [
  38.             'departments' => $departments,
  39.         ]);
  40.     }
  41.     public function qualityPolicy(): ?Response
  42.     {
  43.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/quality-policy.html.twig', [
  44.         ]);
  45.     }
  46.     public function team(Request $requestViDiWorkerModel $viDiWorkerModel): ?Response
  47.     {
  48.         $workers $viDiWorkerModel->getAllByDealer($this->getDealer(), $request->getLocale());
  49.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/team.html.twig', [
  50.             'workers' => $workers,
  51.             'callbackForm' => $this->CoreFormFactory()->orderCallForm(null$this->getDealer())->createView(),
  52.         ]);
  53.     }
  54.     public function vacancy(): ?Response
  55.     {
  56.         $vacancies $this->em->getRepository(Vacancy::class)->getByDealer($this->getDealer());
  57.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/vacancy.html.twig', [
  58.             'vacancies' => $vacancies,
  59.         ]);
  60.     }
  61.     public function vacancySingle($id): ?Response
  62.     {
  63.         $vacancy $this->em->getRepository(Vacancy::class)->getByID($id);
  64.         if (!$vacancy) {
  65.             throw new NotFoundHttpException();
  66.         }
  67.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/vacancy-single.html.twig', [
  68.             'vacancy' => $vacancy,
  69.             'vacancyForm' => $this->CoreFormFactory()->vacancyForm($this->getDealer(), $vacancy)->createView(),
  70.         ]);
  71.     }
  72.     public function news(): ?Response
  73.     {
  74.         $posts $this->em->getRepository(\CoreBundle\Entity\Post::class)->getNewsByDealer($this->getDealer());
  75.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/news.html.twig', [
  76.             'posts' => $posts
  77.         ]);
  78.     }
  79.     public function newsSingle(Request $requestPost $postModel): ?Response
  80.     {
  81.         $post $postModel->initByUrl($this->getDealer(), $request->get('url'), Post::POST_TYPE_NEWS);
  82.         if (!$post) {
  83.             throw $this->createNotFoundException();
  84.         }
  85.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/news-single.html.twig', [
  86.             'post' => $post,
  87.         ]);
  88.     }
  89.     public function actions(): ?Response
  90.     {
  91.         $posts['cars'] = $this->em->getRepository(\CoreBundle\Entity\Post::class)->getActionsByDealer($this->getDealer(), Post::ACTION_TYPE_CAR);
  92.         $posts['service'] = $this->em->getRepository(\CoreBundle\Entity\Post::class)->getActionsByDealer($this->getDealer(), Post::ACTION_TYPE_SERVICE);
  93.         $posts['all'] = array_merge($posts['cars'], $posts['service']);
  94.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/actions.html.twig', ['posts' => $posts]);
  95.     }
  96.     public function actionsSingle(Request $requestPost $postModel): ?Response
  97.     {
  98.         $post $postModel->initByUrl($this->getDealer(), $request->get('url'), Post::POST_TYPE_ACTIONS);
  99.         if (!$post) {
  100.             throw $this->createNotFoundException();
  101.         }
  102.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/actions-single.html.twig', [
  103.             'post' => $post,
  104.         ]);
  105.     }
  106.     public function publicOffer(): ?Response
  107.     {
  108.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/public-offer.html.twig', ['dealer' => $this->getDealer()]);
  109.     }
  110.     public function returnRefundPolicies(): ?Response
  111.     {
  112.         return $this->baseToyotaBorispol('@DcSite/Toyota_Borispol/About/return-refund-policies.html.twig');
  113.     }
  114. }