Bootstrap this event.

Executes in() then init() on the next event= in the filter chain
before returning to execute out().

@param Proem\Filter\ChainManagerInterface $chainManager
@param array Optional extra parameters.
511771
public function init(ChainManagerInterface $chainManager, array $params = [])
    {
        $this->in($chainManager->getAssetManager());

        if ($chainManager->hasEvents()) {
            $event = $chainManager->getNextEvent();
            if (is_object($event)) {
                $event->init($chainManager);
            }
        }

        $this->out($chainManager->getAssetManager());

        return $this;
    }
917570
protected function init(Manager $evtManager)
    {
        $this->evtManager = $evtManager;
        $events = $this->evtManager->getDebugEvents();
        foreach ($events as $event) {
            $this->evtManager->addHandler($event, [$this, 'handler']);
        }
        $this->evtManager->addHandler(
            ':updateLogRegistry:', [$this, 'onUpdateRegistry']
        );
    }
526756
public function processEvent(
        Interfaces\EventInterface $event,
        callable $callback = null
    )/*# : EventManagerInterface */ {
        $eventName = $event->getName();

        // check self's queue
        $queue = $this->matchEventQueue($eventName, $this);

        // merge with other managers' queue
        $managers = $this->getOtherManagers();
        foreach ($managers as $mgr) {
            // other manager's own queue
            $q = $this->matchEventQueue($eventName, $mgr);
            if ($q->count()) {
                $queue = $queue->combine($q);
            }
        }

        // run thru the queue
        return $this->runEventQueue($event, $queue, $callback);
    }
852965
public function handle(ModuleManagerInterface $manager)
    {
        $key      = $this->argument('module');
        $onlyKeys = $this->option('keys');

        if ( ! $key) {
            // Show all modules
            if ($onlyKeys) {
                $this->displayKeys($manager->getModules());
            } else {
                $this->displayList($manager->getModules());
            }
            return;
        }

        // Try by key
        $module = $manager->get($key);

        if ($module) {
            $this->displaySingle($module);
            return;
        }

        $this->error("Unable to find information for module by key '{$key}'");
    }
1299626
public function bootstrap(EventInterface $initEvent = null)
    {
        if ($initEvent === null) {
            $initEvent = new Event('proem.init');
        }

        $this->assetManager->resolve('eventManager')->trigger($initEvent);

        $this->assetManager->resolve('chainManager')
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Request'))
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Route'))
            ->attach($this->assetManager->resolve('Proem\Bootstrap\Dispatch'))
            ->bootstrap();

        return $this;
    }
1128509
public function init(ModuleManagerInterface $manager)
    {
        if (!$manager instanceof ModuleManager) {
            $errMsg =sprintf('Module manager not implement %s', ModuleManager::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        
        /** @var ServiceLocatorInterface $sm */
        $sm = $manager->getEvent()->getParam('ServiceManager');

        if (!$sm instanceof ServiceLocatorInterface) {
            $errMsg = sprintf('Service locator not implement %s', ServiceLocatorInterface::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }
        /** @var ServiceListenerInterface $serviceListener */
        $serviceListener = $sm->get('ServiceListener');
        if (!$serviceListener instanceof ServiceListenerInterface) {
            $errMsg = sprintf('ServiceListener not implement %s', ServiceListenerInterface::class);
            throw new Exception\InvalidArgumentException($errMsg);
        }


        $serviceListener->addServiceManager(
            EntryNameResolverManagerInterface::class,
            EntryNameResolverManager::CONFIG_KEY,
            EntryNameResolverProviderInterface::class,
            'getEntryNameResolverConfig'
        );

    }
629960
public function init(ModuleManagerInterface $manager)
    {
        $events = $manager->getEventManager();
        $events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'addPageTypes'));
        $events->attach(ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'addBlocks'));
    }
924954
public function init()
    {
        Profiler::start('moduleManager', 'init');
        $module = $this->load($this->directory, array(), true);
        if ($module) {
            $this->mainModule = $module;
            $this->add($module);
//            Profiler::start('moduleManager Init');
            $this->mainModule->init();
            $this->mainModule->register_events();
            if (isset($this->config['modules'])) {
                $this->loadConfig($this->config, $this->mainModule);
            }

            foreach ($this->modules as $module) {
                    $module->init();
                    $module->register_router($this->router);
            }
            foreach ($this->modules as $module) {
                if ($module !== $this->mainModule) {
                    $module->register_events();
                }
            }
//            dump($this->modules);
//            die();
//            Profiler::stop('moduleManager Init');
        } else {
            $file = $this->directory . "/config.yml";
            throw new \Exception('Can\'t not load the main module! Looking for: \'' . $file . '\'. folder 
            realpath: ' . realpath($this->directory));
        }
        Profiler::stop('moduleManager');
    }
402797
public function boot(DoctrineManager $manager)
    {
        $manager->extendAll(function (Configuration $configuration) {
            $configuration->setCustomDatetimeFunctions($this->datetime);
            $configuration->setCustomNumericFunctions($this->numeric);
            $configuration->setCustomStringFunctions($this->string);
        });
    }
733509
public function onBootstrap(EventInterface $e)
    {
        /** @var MvcEvent $e */
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener = new ModuleRouteListener();
        $moduleRouteListener->attach($eventManager);

        /** @var Workflow $workflowService */
        $workflowService = $e->getApplication()->getServiceManager()->get(Workflow::class);
        $listener = $e->getApplication()->getServiceManager()->get(InjectTypeResolver::class);
        $workflowService->getEventManager()->attach($listener);
    }
51203
protected function registerMappingDrivers($objectManager, ContainerBuilder $container)
    {
        // configure metadata driver for each bundle based on the type of mapping files found
        if ($container->hasDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'))) {
            $chainDriverDef = $container->getDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'));
        } else {
            $chainDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.driver_chain.class%'));
            $chainDriverDef->setPublic(false);
        }

        foreach ($this->drivers as $driverType => $driverPaths) {
            $mappingService = $this->getObjectManagerElementName($objectManager['name'].'_'.$driverType.'_metadata_driver');
            if ($container->hasDefinition($mappingService)) {
                $mappingDriverDef = $container->getDefinition($mappingService);
                $args = $mappingDriverDef->getArguments();
                if ('annotation' == $driverType) {
                    $args[1] = array_merge(array_values($driverPaths), $args[1]);
                } else {
                    $args[0] = array_merge(array_values($driverPaths), $args[0]);
                }
                $mappingDriverDef->setArguments($args);
            } elseif ('annotation' == $driverType) {
                $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
                    new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
                    array_values($driverPaths),
                ]);
            } else {
                $mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), [
                    array_values($driverPaths),
                ]);
            }
            $mappingDriverDef->setPublic(false);
            if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) {
                $mappingDriverDef->setArguments([array_flip($driverPaths)]);
                $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']);
            }

            $container->setDefinition($mappingService, $mappingDriverDef);

            foreach ($driverPaths as $prefix => $driverPath) {
                $chainDriverDef->addMethodCall('addDriver', [new Reference($mappingService), $prefix]);
            }
        }

        $container->setDefinition($this->getObjectManagerElementName($objectManager['name'].'_metadata_driver'), $chainDriverDef);
    }
1329083
public function load(ObjectManager $manager)
    {
        /**
         * Carts.
         *
         * @var CartCouponInterface $cartCoupon
         * @var CartInterface       $cart
         * @var CouponInterface     $coupon
         */
        $cartCouponDirectory = $this->getDirector('cart_coupon');

        $cart = $this->getReference('full-cart');
        $coupon = $this->getReference('coupon-percent');

        $cartCoupon = $cartCouponDirectory
            ->create()
            ->setCart($cart)
            ->setCoupon($coupon);

        $cartCouponDirectory->save($cartCoupon);
        $this->addReference('cart-coupon', $cartCoupon);
    }
849144
public function initialize(ExtensionManager $extensionManager) {
    /** @var MinkExtension $minkExtension */
    $minkExtension = $extensionManager->getExtension('mink');
    if (null !== $minkExtension) {
      $minkExtension->registerDriverFactory(new PhantomJSFactory());
    }
  }
636022
public function init(ServiceLocatorInterface $serviceLocator)
    {
        if (true === $this->isInit) {
            return;
        }

        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var ModuleOptionsPluginManagerInterface $moduleOptionsManager */
        $moduleOptionsManager = $appServiceLocator->get(ModuleOptionsPluginManagerInterface::class);
        /** @var ModuleOptionsInterface $moduleOptions */
        $moduleOptions = $moduleOptionsManager->get(ModuleOptionsInterface::class);
        $this->setModuleOptions($moduleOptions);

        /** @var DoctrineOrmModuleConfigInterface $doctrineOrmModuleConfig */
        $doctrineOrmModuleConfig = $appServiceLocator->get(DoctrineOrmModuleConfigInterface::class);

        $listObjectManagerName = $doctrineOrmModuleConfig->getListObjectManagerName();

        /** @var EntityMapCacheInterface $entityMapCache */
        $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class);

        $excludeEntityManagerForAutoBuildEntityMap = $moduleOptions->getExcludeEntityManagerForAutoBuildEntityMap();
        foreach ($listObjectManagerName as $objectManagerName) {
            $flagBuildCache = !in_array($objectManagerName, $excludeEntityManagerForAutoBuildEntityMap, true)
                && $moduleOptions->getFlagAutoBuildEntityMapDoctrineCache()
                && !$entityMapCache->hasEntityMap($objectManagerName);

            if ($flagBuildCache) {
                $entityMapCache->saveEntityMap($objectManagerName);
                if (!$entityMapCache->hasEntityMap($objectManagerName)) {
                    $errMsg = sprintf('Invalid build entity map for: %s', $objectManagerName);
                    throw new Exception\ErrorBuildEntityMapCacheException($errMsg);
                }
            }

            if ($entityMapCache->hasEntityMap($objectManagerName)) {
                $this->objectManagerToEntityMap[$objectManagerName] = $entityMapCache->loadEntityMap($objectManagerName);
            }
        }

        $this->countObjectManagers = count($this->objectManagerToEntityMap);

        if (1 === $this->countObjectManagers) {
            reset($this->objectManagerToEntityMap);
            $this->baseEntityMap = current($this->objectManagerToEntityMap);
        }

        $this->isInit = true;
    }
1255653
public function init( ModuleManagerInterface $manager )
    {
        $this->moduleManager  = $manager;
        $this->serviceLocator = $manager->getEvent()
                                        ->getParam( 'ServiceManager' );

        $shared = $manager->getEventManager()
                          ->getSharedManager();

        $shared->attach(
            'Zend\Stdlib\DispatchableInterface',
            MvcEvent::EVENT_DISPATCH,
            array( new InjectTemplateListener, 'injectTemplate' ),
            -85
        );

        $shared->attach(
         // 'Zend\Mvc\Controller\AbstractController',
            'Zend\Stdlib\DispatchableInterface',
            MvcEvent::EVENT_DISPATCH,
            array( $this, 'onDispatch' ),
            100
        );
    }
1220224
public function addProvider(BlacklistProviderInterface $provider)
    {
        if ($provider === $this) {
            throw new \RuntimeException('Unable to add ChainProvider to itself.');
        }

        $this->providers[] = $provider;

        return $this;
    }
1264392
public function load(ObjectManager $manager)
    {
        $site2 = $this->getReference('site2');
        $site2->addBlock('slideshow');
        $site2->addBlock('gallery');

        $manager->flush();
    }