vendor/pimcore/portal-engine/src/EventSubscriber/PrefixSubscriber.php line 50

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under following license:
  6.  * - Pimcore Commercial License (PCL)
  7.  *
  8.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  9.  *  @license    http://www.pimcore.org/license     PCL
  10.  */
  11. namespace Pimcore\Bundle\PortalEngineBundle\EventSubscriber;
  12. use Pimcore\Bundle\PortalEngineBundle\Service\Document\PrefixService;
  13. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  14. use Symfony\Component\HttpKernel\Event\ControllerEvent;
  15. /**
  16.  * @package Pimcore\Bundle\PortalEngineBundle\EventListener
  17.  */
  18. class PrefixSubscriber implements EventSubscriberInterface
  19. {
  20.     /**
  21.      * @var PrefixService
  22.      */
  23.     protected $prefixService;
  24.     /**
  25.      * PrefixSubscriber constructor.
  26.      *
  27.      * @param PrefixService $prefixService
  28.      */
  29.     public function __construct(
  30.         PrefixService $prefixService
  31.     ) {
  32.         $this->prefixService $prefixService;
  33.     }
  34.     /**
  35.      * @return array
  36.      */
  37.     public static function getSubscribedEvents()
  38.     {
  39.         return [
  40.             'kernel.controller' => ['onKernelController'],
  41.         ];
  42.     }
  43.     public function onKernelController(ControllerEvent $requestEvent)
  44.     {
  45.         $this->prefixService->setupRoutingPrefix();
  46.     }
  47. }