<?php
namespace DcSiteBundle\Controller\NissanArmada;
use CoreBundle\Component\CoreFormFactory;
use CoreBundle\Component\FormManager;
use CoreBundle\Factory\Vehicle as VehicleFactory;
use CoreBundle\Model\Api\OnlineService\ApiServer1C;
use CoreBundle\Model\Vehicles\Repository;
use CoreBundle\Services\MediaExtensionVidi;
use DcSiteBundle\Services\AccessoryShopService;
use Doctrine\ORM\EntityManagerInterface;
use PortalBundle\Model\SeoMetaTag;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\RouterInterface;
use Twig\Environment;
class AccessoriesController extends BaseController
{
public function __construct(CoreFormFactory $coreFormFactory, SeoMetaTag $seoMetaTag, RequestStack $requestStack, RouterInterface $router, FormManager $formManager, EntityManagerInterface $em, ApiServer1C $apiServer1C, SessionInterface $session, Filesystem $filesystem, MediaExtensionVidi $mediaExtensionVidi, Repository $vehicleRepository, VehicleFactory $vehicleFactory, Environment $twig)
{
parent::__construct($coreFormFactory, $seoMetaTag, $requestStack, $router, $formManager, $em, $apiServer1C, $session, $filesystem, $mediaExtensionVidi, $vehicleRepository, $vehicleFactory, $twig);
}
public function accessoriesCatalog(AccessoryShopService $accessoryShopService): ?Response
{
$dealer = $this->getDealer();
$accessoryCatalog = $accessoryShopService->getAccessoryCatalog($dealer);
return $this->baseNissanArmada('@DcSiteBundle/Nissan_Armada/Accessories/accessories-catalog.html.twig', $accessoryCatalog);
}
public function accessoriesCategory(AccessoryShopService $accessoryShopService): ?Response
{
$dealer = $this->getDealer();
$accessoryCategory = $accessoryShopService->getAccessoryCategory($dealer);
if (!$accessoryCategory['accessoryCount']) {
throw new NotFoundHttpException();
} else {
return $this->baseNissanArmada('@DcSite/Nissan_Armada/Accessories/accessories-catalog.html.twig', $accessoryCategory);
}
}
public function accessoriesModel(AccessoryShopService $accessoryShopService): ?Response
{
$dealer = $this->getDealer();
$accessoryModel = $accessoryShopService->getAccessoryModel($dealer);
return $this->baseNissanArmada('@DcSite/Nissan_Armada/Accessories/accessories-catalog.html.twig', $accessoryModel);
}
public function accessoriesPage(AccessoryShopService $accessoryShopService): ?Response
{
$dealer = $this->getDealer();
$accessoryPage = $accessoryShopService->getAccessoryPage($dealer);
return $this->baseNissanArmada('@DcSite/Nissan_Armada/Accessories/accessories-page.html.twig', $accessoryPage);
}
public function accessoriesModelVariation(AccessoryShopService $accessoryShopService): ?Response
{
$dealer = $this->getDealer();
$accessoryModel = $accessoryShopService->getAccessoryModelAndVariation($dealer);
return $this->baseNissanArmada('@DcSite/Nissan_Armada/Accessories/accessories-catalog.html.twig', $accessoryModel);
}
public function accessories(): RedirectResponse
{
return $this->redirect('https://' . $this->getParameter('shop_nissan_armada_host') . '/', Response::HTTP_MOVED_PERMANENTLY);
}
}