protected function getEventsService() { $this->services['events'] = $instance = new \Enlight_Event_EventManager(); $instance->addListener('Enlight_Controller_Front_RouteShutdown', array(0 => $this->get('theme_backend_registration'), 1 => 'registerBackendTheme')); $instance->addListener('Enlight_Controller_Front_RouteStartup', array(0 => $this->get('monolog.handler.chromephp'), 1 => 'onRouteStartUp')); $instance->addListener('Enlight_Controller_Front_RouteStartup', array(0 => $this->get('monolog.handler.firephp'), 1 => 'onRouteStartUp')); $instance->addSubscriber($this->get('legacy_listing_converter')); $instance->addSubscriber($this->get('legacy_search_converter')); $instance->addSubscriber(new \Shopware\Components\AttributeSubscriber($this)); $instance->addSubscriber($this->get('theme_config_loader')); $instance->addSubscriber($this->get('shopware_elastic_search.service_subscriber')); $instance->addSubscriber(new \Shopware\Bundle\ESIndexingBundle\Subscriber\DomainBacklogSubscriber($this)); $instance->addSubscriber($this->get('shopware_media.service_subscriber')); return $instance; }
/** * @return void */ public function start() { $this->eventManager->addListener('Enlight_Controller_Front_PostDispatch', array($this, 'onPostDispatch')); }
/** * @param $eventName * @param $listener * @param int $priority * @return Enlight_Event_EventManager */ public function addListener($eventName, $listener, $priority = 0) { return $this->events->addListener($eventName, $listener, $priority); }
/** * @param Container $container * @param EnlightEventManager $eventManager * @return \Shopware\Components\Routing\RouterInterface * @throws \Exception */ public function factory(Container $container, EnlightEventManager $eventManager) { $queryAliasMapper = $container->get('query_alias_mapper'); $matchers = [new Matchers\RewriteMatcher($container->get('dbal_connection'), $queryAliasMapper), new Matchers\EventMatcher($eventManager), new Matchers\DefaultMatcher($container->get('dispatcher'))]; $generators = [new Generators\RewriteGenerator($container->get('dbal_connection'), $queryAliasMapper), new Generators\DefaultGenerator($container->get('dispatcher'))]; $preFilters = [new GeneratorFilters\DefaultPreFilter(), new GeneratorFilters\FrontendPreFilter()]; $postFilters = [new GeneratorFilters\FrontendPostFilter(), new GeneratorFilters\DefaultPostFilter()]; $router = new \Shopware\Components\Routing\Router(Context::createEmpty(), $matchers, $generators, $preFilters, $postFilters); /** Still better than @see \Shopware\Models\Shop\Shop::registerResources */ $eventManager->addListener('Enlight_Bootstrap_AfterRegisterResource_Shop', array($this, 'onAfterRegisterShop'), -100); $eventManager->addListener('Enlight_Controller_Front_PreDispatch', array($this, 'onPreDispatch'), -100); return $router; }