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

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.     public static function getSubscribedEvents()
  35.     {
  36.         return [
  37.             'kernel.controller' => ['onKernelController'],
  38.         ];
  39.     }
  40.     public function onKernelController(ControllerEvent $requestEvent)
  41.     {
  42.         $this->prefixService->setupRoutingPrefix();
  43.     }
  44. }