当前位置: 首页>>代码示例>>PHP>>正文


PHP ModuleEvent::getConfigListener方法代码示例

本文整理汇总了PHP中Zend\ModuleManager\ModuleEvent::getConfigListener方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleEvent::getConfigListener方法的具体用法?PHP ModuleEvent::getConfigListener怎么用?PHP ModuleEvent::getConfigListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\ModuleManager\ModuleEvent的用法示例。


在下文中一共展示了ModuleEvent::getConfigListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onMergeConfig

 /**
  * @param ModuleEvent $event
  * @throws Exception
  */
 public function onMergeConfig(ModuleEvent $event)
 {
     // do not parse annotations if config cache is enabled.
     $config = $event->getConfigListener()->getMergedConfig(false);
     $annotationReader = AnnotationReaderFactory::factory($config['zf_annotation']);
     $parser = ClassParserFactory::factory($config, $event->getTarget()->getEventManager(), $annotationReader);
     $scanner = new DirectoryScanner();
     $classesToParse = [];
     $modules = $event->getTarget()->getLoadedModules();
     $modulesAllowedToScan = $config['zf_annotation']['scan_modules'];
     foreach ($modules as $module) {
         $parts = explode('\\', get_class($module));
         $modName = array_shift($parts);
         if (!empty($modulesAllowedToScan) && !in_array($modName, $modulesAllowedToScan)) {
             continue;
         }
         $ref = new ReflectionClass($module);
         $dir = dirname($ref->getFileName());
         foreach ($scanner->scan($dir) as $class) {
             $classesToParse[] = $class;
         }
     }
     $parsedConfig = $parser->parse($classesToParse);
     $event->getConfigListener()->setMergedConfig(array_replace_recursive($parsedConfig, $config));
 }
开发者ID:alex-oleshkevich,项目名称:zf-annotations,代码行数:29,代码来源:Module.php

示例2: onConfigMerge

 /**
  *
  * @param \Zend\EventManager\Event $event
  */
 public function onConfigMerge(ModuleEvent $event)
 {
     $config = $event->getConfigListener()->getMergedConfig(false);
     foreach ($config['sds']['doctrineExtensions']['manifest'] as $name => $manifestConfig) {
         if (!isset($manifestConfig['initalized']) || !$manifestConfig['initalized']) {
             $manifest = new Manifest($manifestConfig);
             $manifestConfig = $manifest->toArray();
             $config['sds']['doctrineExtensions']['manifest'][$name] = $manifestConfig;
             //alias documentManager
             //add delegators
             $documentManagerConfig = $config;
             foreach (explode('.', $manifestConfig['document_manager']) as $key) {
                 $documentManagerConfig = $documentManagerConfig[$key];
             }
             $delegatorConfig = ['delegators' => [$manifestConfig['document_manager'] => ['doctrineExtensions.' . $name . '.documentManagerDelegatorFactory'], $documentManagerConfig['eventmanager'] => ['doctrineExtensions.' . $name . '.eventManagerDelegatorFactory'], $documentManagerConfig['configuration'] => ['doctrineExtensions.' . $name . '.configurationDelegatorFactory']]];
             $config['service_manager'] = ArrayUtils::merge($config['service_manager'], $delegatorConfig);
         }
     }
     if (!isset($config['sds']['doctrineExtensions']['manifest']['default']) || !isset($config['sds']['doctrineExtensions']['manifest']['default']['extension_configs']['extension.dojo'])) {
         //remove dojo_src.default route if doctrineExtensions.dojo.default is not configured
         unset($config['router']['routes']['dojo.default']);
     }
     if (!isset($config['sds']['doctrineExtensions']['manifest']['default']) || !isset($config['sds']['doctrineExtensions']['manifest']['default']['extension_configs']['extension.rest'])) {
         //remove rest.default route if doctrineExtensions.rest.default is not configured
         unset($config['router']['routes']['rest.default']);
     }
     $event->getConfigListener()->setMergedConfig($config);
 }
开发者ID:superdweebie,项目名称:doctrine-extensions-module,代码行数:32,代码来源:Module.php

示例3: extendRoutes

 /**
  * @param ModuleEvent $e
  * @throws InvalidArgumentException
  */
 public function extendRoutes(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     // Allow extension of routes with overriding capability
     if (isset($config['router']['inheritance']) && is_array($config['router']['inheritance'])) {
         foreach ($config['router']['inheritance'] as $newRoute => $routeConfig) {
             // Not going to override any existing routes
             if (isset($config['router']['routes'][$newRoute])) {
                 throw new InvalidArgumentException('Cannot extend route to existing route id.');
             }
             // parent route must be provided
             if (!isset($routeConfig['extends'])) {
                 throw new InvalidArgumentException('Parent route must be defined.');
             }
             // parent route must exist
             if (!isset($config['router']['routes'][$routeConfig['extends']])) {
                 throw new InvalidArgumentException('Parent route does not exist.');
             }
             // If there is any configuration provided, it must be iterable
             if (isset($routeConfig['configuration']) && !is_array($routeConfig['configuration'])) {
                 throw new InvalidArgumentException('Route overrides must be iterable.');
             }
             // Copying the parent config and merging in the overrides
             $newRouteConfig = $config['router']['routes'][$routeConfig['extends']];
             $newRouteConfig = ArrayUtils::merge($newRouteConfig, $routeConfig['configuration']);
             $config['router']['routes'][$newRoute] = $newRouteConfig;
         }
         // Removing this node so this isn't re-executed
         unset($config['router']['inheritance']);
     }
     // Pass the changed configuration back to the listener:
     $configListener->setMergedConfig($config);
 }
开发者ID:hickeroar,项目名称:zf2-route-inheritance,代码行数:38,代码来源:Module.php

示例4: onMergeConfig

 public function onMergeConfig(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     // Modify the configuration; here, we'll add Oracle Custom DQL Functions:
     if (isset($config['doctrine_extensions']['oracle_doctrine_driver_config_key'])) {
         $configKey = $config['doctrine_extensions']['oracle_doctrine_driver_config_key'];
         //Get existing map (if any) to be merged with the module map
         if (isset($config['doctrine']['configuration'][$configKey])) {
             $existingMap = $config['doctrine']['configuration'][$configKey];
         } else {
             $existingMap = array();
         }
         $config['doctrine']['configuration'][$configKey] = array_merge_recursive($existingMap, DoctrineExtensionsUtilts::getOracleDQLFunctions());
     }
     // Modify the configuration; here, we'll add MySQL Custom DQL Functions:
     if (isset($config['doctrine_extensions']['mysql_doctrine_driver_config_key'])) {
         $configKey = $config['doctrine_extensions']['mysql_doctrine_driver_config_key'];
         //Get existing map (if any) to be merged with the module map
         if (isset($config['doctrine']['configuration'][$configKey])) {
             $existingMap = $config['doctrine']['configuration'][$configKey];
         } else {
             $existingMap = array();
         }
         $config['doctrine']['configuration'][$configKey] = array_merge_recursive($existingMap, DoctrineExtensionsUtilts::getMysqlDQLFunctions());
     }
     // Pass the changed configuration back to the listener:
     $configListener->setMergedConfig($config);
 }
开发者ID:pradeep-sanjaya,项目名称:doctrine-extensions,代码行数:29,代码来源:Module.php

示例5: onMergeConfig

 /**
  * 
  * @param ModuleEvent $event
  */
 public function onMergeConfig(ModuleEvent $event)
 {
     $config = $event->getConfigListener()->getMergedConfig(false);
     $modules = $event->getTarget()->getLoadedModules();
     foreach ($modules as $module) {
         $ref = new ReflectionClass($module);
         $dir = dirname($ref->getFileName()) . '/view';
         if (!is_dir($dir)) {
             continue;
         }
         if (!isset($config['view_manager']['template_path_stack'])) {
             $config['view_manager']['template_path_stack'] = array();
         }
         $config['view_manager']['template_path_stack'][] = $dir;
     }
     $event->getConfigListener()->setMergedConfig($config);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:21,代码来源:TemplateStackResolver.php

示例6: onMergeConfig

 public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $event)
 {
     $configListener = $event->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     //        echo '<pe>';
     //        print_r($config);
     //        echo '</pre>';
 }
开发者ID:htam261,项目名称:zendskeleton,代码行数:8,代码来源:Module.php

示例7: onMergeConfig

 public function onMergeConfig(ModuleEvent $moduleEvent)
 {
     $configListener = $moduleEvent->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     // echo "<pre style='font-weight:bold'>";
     // print_r($config['controllers']);
     // echo "</pre>";
 }
开发者ID:trongle,项目名称:zend-2,代码行数:8,代码来源:Module.php

示例8: onPostLoadModules

 /**
  * @param ModuleEvent $e
  */
 public function onPostLoadModules(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     if (isset($config['doctrine']['configuration']['orm_default']['proxy_dir']) && isset($config['doctrine']['configuration']['orm_default']['proxy_namespace'])) {
         // We need to register here manualy. Please see http://www.doctrine-project.org/jira/browse/DDC-1698
         ProxyAutoloader::register($config['doctrine']['configuration']['orm_default']['proxy_dir'], $config['doctrine']['configuration']['orm_default']['proxy_namespace']);
     }
 }
开发者ID:coolms,项目名称:doctrine-orm,代码行数:12,代码来源:Module.php

示例9: onMergeConfig

 public function onMergeConfig(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     // Make sure the router class is set to LocaleAwareTreeRouteStack
     if (!Console::isConsole()) {
         $config['router']['router_class'] = 'LocaleManager\\Router\\Http\\LocaleTreeRouteStack';
     }
     // Pass the changed configuration back to the listener:
     $configListener->setMergedConfig($config);
 }
开发者ID:JPG-Consulting,项目名称:LocaleManager-OLD,代码行数:11,代码来源:Module.php

示例10: onMergeConfig

 public function onMergeConfig(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     // Modify the configuration; here, we'll remove a specific key:
     if (isset($config['service_manager']['invokables']['VuFind\\Search'])) {
         unset($config['service_manager']['invokables']['VuFind\\Search']);
     }
     // Pass the changed configuration back to the listener:
     $configListener->setMergedConfig($config);
 }
开发者ID:paulusova,项目名称:VuFind-2.x,代码行数:11,代码来源:Module.php

示例11: onLoadModulesPost

 /**
  * @param ModuleEvent $e
  */
 public function onLoadModulesPost(ModuleEvent $e)
 {
     $appConfig = $this->serviceLocator->getServiceLocator()->get('ApplicationConfig');
     $extraConfig = array();
     if (isset($appConfig['framework']['app_config'])) {
         $extraConfig = Config::load($appConfig['framework']['app_config']);
     }
     // env config
     if (isset($appConfig['framework']['env_key'])) {
         $env = getenv($appConfig['framework']['env_key']);
         if ($env) {
             $filename = 'config/env/' . $env . '.yml';
             if (is_file($filename)) {
                 $envConfig = Config::load($filename);
                 $extraConfig = array_replace_recursive($extraConfig, $envConfig);
             }
         }
     }
     $config = ArrayUtils::merge($e->getConfigListener()->getMergedConfig(false), $extraConfig);
     $e->getConfigListener()->setMergedConfig($config);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:24,代码来源:ConfigMergerListener.php

示例12: onMergeConfig

 /**
  * Override ZF\OAuth2\Service\OAuth2Server service
  *
  * If the ZF\OAuth2\Service\OAuth2Server is defined, and set to the
  * default, override it with the NamedOAuth2ServerFactory.
  *
  * @param ModuleEvent $e
  */
 public function onMergeConfig(ModuleEvent $e)
 {
     $configListener = $e->getConfigListener();
     $config = $configListener->getMergedConfig(false);
     $service = 'ZF\\OAuth2\\Service\\OAuth2Server';
     $default = 'ZF\\OAuth2\\Factory\\OAuth2ServerFactory';
     if (!isset($config['service_manager']['factories'][$service]) || $config['service_manager']['factories'][$service] !== $default) {
         return;
     }
     $config['service_manager']['factories'][$service] = __NAMESPACE__ . '\\Factory\\NamedOAuth2ServerFactory';
     $configListener->setMergedConfig($config);
 }
开发者ID:nuxwin,项目名称:zf-mvc-auth,代码行数:20,代码来源:Module.php

示例13: onMergeConfig

 /**
  * 
  * @param ModuleEvent $event
  */
 public function onMergeConfig(ModuleEvent $event)
 {
     $config = $event->getConfigListener()->getMergedConfig(false);
     $modules = $event->getTarget()->getLoadedModules();
     foreach ($modules as $module) {
         $ref = new ReflectionClass($module);
         $dir = dirname($ref->getFileName()) . '/language';
         if (!is_dir($dir)) {
             continue;
         }
         $iterator = new \DirectoryIterator($dir);
         foreach ($iterator as $file) {
             if ($file->isFile()) {
                 list($domain, $locale, $type) = explode('.', $file->getFilename());
                 if ($type === 'php') {
                     $type = 'phparray';
                 }
                 $config['translator']['translation_files'][] = array('type' => $type, 'filename' => $file->getPathname(), 'text_domain' => $domain, 'locale' => $locale);
             }
         }
     }
     $event->getConfigListener()->setMergedConfig($config);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:27,代码来源:TranslationResolver.php

示例14: onMergeConfig

 /**
  * 
  * @param ModuleEvent $event
  */
 public function onMergeConfig(ModuleEvent $event)
 {
     $config = $event->getConfigListener()->getMergedConfig(false);
     $modules = $event->getTarget()->getLoadedModules();
     foreach ($modules as $module) {
         $ref = new ReflectionClass($module);
         $dir1 = dirname($ref->getFileName()) . '/Entity';
         $dir2 = dirname($ref->getFileName()) . '/src/Entity';
         $dirs = array_filter([$dir1, $dir2], 'is_dir');
         if (count($dirs) == 0) {
             continue;
         }
         $dir = current($dirs);
         $parts = explode('\\', get_class($module));
         $moduleName = array_shift($parts);
         if (in_array($moduleName, $this->ignoreModules)) {
             continue;
         }
         $driverName = strtolower($moduleName) . '_entities';
         $config['doctrine']['driver']['orm_default']['drivers'][sprintf('%s\\Entity', $moduleName)] = $driverName;
         $config['doctrine']['driver'][$driverName] = array('class' => 'Doctrine\\ORM\\Mapping\\Driver\\AnnotationDriver', 'cache' => 'array', 'paths' => array($dir));
     }
     $event->getConfigListener()->setMergedConfig($config);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:28,代码来源:EntityResolver.php

示例15: onMergeConfig

 /**
  * 
  * @param ModuleEvent $event
  */
 public function onMergeConfig(ModuleEvent $event)
 {
     $config = $event->getConfigListener()->getMergedConfig(false);
     $resolvedControllers = $this->resolveControllers($config);
     $controllerInvokables = empty($config['controllers']['invokables']) ? [] : $config['controllers']['invokables'];
     $controllerFactories = empty($config['controllers']['factories']) ? [] : $config['controllers']['factories'];
     $controllers = array_merge($controllerInvokables, $controllerFactories);
     $injections = array();
     foreach ($controllers as $controller) {
         $ref = new ReflectionClass($controller);
         $fileScanner = new FileScanner($ref->getFileName());
         $classScanner = $fileScanner->getClass($controller);
         $methods = $classScanner->getMethods();
         $className = $classScanner->getName();
         $controllerName = $resolvedControllers[$className];
         foreach ($methods as $method) {
             $methodName = $method->getName();
             $actionName = preg_replace('/Action$/', '', $methodName);
             foreach ($method->getParameters() as $parameter) {
                 $parameterScanner = $method->getParameter($parameter);
                 $parameterName = $parameterScanner->getName();
                 $class = $parameterScanner->getClass();
                 if ($class) {
                     $objectManager = $this->detectObjectManager($class, $config['mvc']['doctrine_object_injector']);
                     if (null !== $objectManager) {
                         $injections[$controllerName][$actionName][$parameterName] = [$class, $objectManager, !$parameterScanner->isOptional()];
                     }
                 } else {
                     $injections[$controllerName][$actionName][$parameterName] = null;
                 }
             }
         }
     }
     $config['mvc']['doctrine_object_injector']['injections'] = $injections;
     $event->getConfigListener()->setMergedConfig($config);
 }
开发者ID:alex-oleshkevich,项目名称:zf-extras,代码行数:40,代码来源:DoctrineObjectInjectionListener.php


注:本文中的Zend\ModuleManager\ModuleEvent::getConfigListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。