src/Import1CBundle/Controller/v3/FactoryServiceController.php line 33

Open in your IDE?
  1. <?php
  2. namespace Import1CBundle\Controller\v3;
  3. use Import1CBundle\Controller\BaseController;
  4. use Import1CBundle\Helper\v3\RequestBiHelper;
  5. use Import1CBundle\Service\v3\FactoryService;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use WebBundle\Entity\Factory;
  10. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  11. /**
  12.  * Class FactoryServiceController
  13.  * @Route("/factory/output")
  14.  * @package Import1CBundle\Controller\v3
  15.  */
  16. class FactoryServiceController extends BaseController
  17. {
  18.     private FactoryService $factoryService;
  19.     public function __construct(FactoryService $factoryService)
  20.     {
  21.         $this->factoryService $factoryService;
  22.     }
  23.     /**
  24.      * получить список фабрик на сайте, если БМ то выывести его список
  25.      * если редактор - то список всех фабрик
  26.      * @Route("/te", name="bi.3.factory.te")
  27.      */
  28.     public function listFactoryAction(): Response
  29.     {
  30.         ini_set('memory_limit''500M');
  31.         if (!$this->isGranted('ROLE_BI')) {
  32.             throw new AccessDeniedHttpException('Доступ запрещен');
  33.         }
  34.         $params RequestBiHelper::factoryRequest([
  35.             'userRoleSign' => $this->userRoleSign,
  36.             'userRoleBm' => $this->userRoleBm,
  37.             'user' => $this->user,
  38.         ]);
  39.         $data $this->factoryService->listFactory($params);
  40.         return $this->render('@Import1C/factory-service/v3/list-factory.html.twig'$data);
  41.     }
  42.     /**
  43.      * открывает форму для просмотра данных фабрики
  44.      * @Route("/show/{id}", name="bi.3.factory.show")
  45.      * @ParamConverter(name="factory", class="WebBundle\Entity\Factory", options={"mapping":{"id":"id"}})
  46.      */
  47.     public function showFactoryAction(Factory $factory): Response
  48.     {
  49.         if (!$this->isGranted('ROLE_BI')) {
  50.             throw new AccessDeniedHttpException('Доступ запрещен');
  51.         }
  52.         $params RequestBiHelper::factoryRequest([
  53.             'userRoleSign' => $this->userRoleSign,
  54.             'userRoleBm' => $this->userRoleBm,
  55.             'userRoleDev' => $this->userRoleDev,
  56.             'factory' => $factory,
  57.         ]);
  58.         $data $this->factoryService->factoryShow($params);
  59.         return $this->render('@Import1C/factory-service/v3/show.html.twig'$data);
  60.     }
  61. }