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


PHP Loader\XmlFileLoader类代码示例

本文整理汇总了PHP中Symfony\Component\DependencyInjection\Loader\XmlFileLoader的典型用法代码示例。如果您正苦于以下问题:PHP XmlFileLoader类的具体用法?PHP XmlFileLoader怎么用?PHP XmlFileLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     foreach (array('services', 'form') as $service) {
         $loader->load(sprintf('%s.xml', $service));
     }
     if ($config['service'] == 's3') {
         $loader->load('s3.xml');
     } else {
         $loader->load('connector.xml');
     }
     switch ($config['service']) {
         case 'php':
             $container->setAlias('jonlil_ckfinder.connector', 'jonlil.ckfinder.connector.php');
             break;
         case 's3':
             $container->setAlias('jonlil_ckfinder.connector', 'jonlil.ckfinder.connector.s3');
             $container->setParameter('jonlil_ckfinder.amazon', array('secret' => $config['secret'], 'bucket' => $config['bucket'], 'access_key' => $config['accessKey'], 'base_url' => $config['baseUrl'], 'base_dir' => $config['baseDir'], 'thumbnails_file' => $config['thumbnailsFile'], 'thumbnails_enabled' => $config['thumbnailsEnabled'], 'direct_access' => $config['directAccess'], 'file_delete' => $config['fileDelete'], 'file_rename' => $config['fileRename'], 'file_upload' => $config['fileUpload'], 'file_view' => $config['fileView'], 'folder_delete' => $config['folderDelete'], 'folder_rename' => $config['folderRename'], 'folder_create' => $config['folderCreate'], 'folder_view' => $config['folderView']));
             $container->setParameter('jonlil_ckfinder.baseDir', $config['baseDir']);
             break;
     }
     $container->setParameter('jonlil_ckfinder.license', array('key' => $config['license']['key'], 'name' => $config['license']['name']));
     $container->setParameter('jonlil_ckfinder.baseUrl', $config['baseUrl']);
     $container->setParameter('twig.form.resources', array_merge($container->getParameter('twig.form.resources'), array('JonlilCKFinderBundle:Form:ckfinder_widget.html.twig')));
 }
开发者ID:spin7ion,项目名称:JonlilCKFinderBundle,代码行数:30,代码来源:JonlilCKFinderExtension.php

示例2: load

 public function load(array $pluginConfiguration, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config'));
     foreach (['services'] as $basename) {
         $loader->load(sprintf('%s.xml', $basename));
     }
 }
开发者ID:gitter-badger,项目名称:OAuth2ServerBundle,代码行数:7,代码来源:CleanerPlugin.php

示例3: load

 /**
  * {@inheritDoc}
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('form_flow.xml');
     $loader->load('twig.xml');
     $loader->load('util.xml');
 }
开发者ID:placid2000,项目名称:CraueFormFlowBundle,代码行数:10,代码来源:CraueFormFlowExtension.php

示例4: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('plugins.xml');
     // Register default services
     foreach ($config['classes'] as $service => $class) {
         if (!empty($class)) {
             $container->register(sprintf('httplug.%s.default', $service), $class);
         }
     }
     // Set main aliases
     foreach ($config['main_alias'] as $type => $id) {
         $container->setAlias(sprintf('httplug.%s', $type), $id);
     }
     // Configure toolbar
     if ($this->isConfigEnabled($container, $config['profiling'])) {
         $loader->load('data-collector.xml');
         if (!empty($config['profiling']['formatter'])) {
             // Add custom formatter
             $container->getDefinition('httplug.collector.debug_collector')->replaceArgument(0, new Reference($config['profiling']['formatter']));
         }
         $container->getDefinition('httplug.formatter.full_http_message')->addArgument($config['profiling']['captured_body_length']);
     }
     $this->configureClients($container, $config);
     $this->configureSharedPlugins($container, $config['plugins']);
     // must be after clients, as clients.X.plugins might use plugins as templates that will be removed
     $this->configureAutoDiscoveryClients($container, $config);
 }
开发者ID:php-http,项目名称:HttplugBundle,代码行数:34,代码来源:HttplugExtension.php

示例5: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $services = array('orm' => 'orm-services');
     $supportedEncryptorClasses = array('aes256' => 'VMelnik\\DoctrineEncryptBundle\\Encryptors\\AES256Encryptor');
     if (empty($config['secret_key'])) {
         if ($container->hasParameter('secret')) {
             $config['secret_key'] = $container->getParameter('secret');
         } else {
             throw new \RuntimeException('You must provide "secret_key" for DoctrineEncryptBundle or "secret" for framework');
         }
     }
     if (!empty($config['encryptor_class'])) {
         $encryptorFullName = $config['encryptor_class'];
     } else {
         $encryptorFullName = $supportedEncryptorClasses[$config['encryptor']];
     }
     $container->setParameter('vmelnik_doctrine_encrypt.encryptor_class_name', $encryptorFullName);
     $container->setParameter('vmelnik_doctrine_encrypt.secret_key', $config['secret_key']);
     if (!empty($config['encryptor_service'])) {
         $container->setParameter('vmelnik_doctrine_encrypt.encryptor_service', $config['encryptor_service']);
     }
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load(sprintf('%s.xml', $services[$config['db_driver']]));
 }
开发者ID:krishnavelugula,项目名称:DoctrineEncryptBundle,代码行数:29,代码来源:VMelnikDoctrineEncryptExtension.php

示例6: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $container->setParameter('eo_airbrake.api_key', $config['api_key']);
     $container->setParameter('eo_airbrake.async', $config['async']);
     $container->setParameter('eo_airbrake.host', $config['host']);
     $container->setParameter('eo_airbrake.secure', $config['secure']);
     // Exception Listener
     if ($config['api_key']) {
         // Airbreak Configuration
         $class = $container->getParameter('eo_airbrake.configuration.class');
         $definition = new Definition($class, array($config['api_key'], $config['async'], $container->getParameter('kernel.environment'), $config['host'], $config['secure']));
         $container->setDefinition('eo_airbrake.configuration', $definition);
         // Airbreak Client
         $class = $container->getParameter('eo_airbrake.client.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.configuration')));
         $container->setDefinition('eo_airbrake.client', $definition);
         // Exception Listener
         $class = $container->getParameter('eo_airbrake.exception_listener.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.client'), $config['ignored_exceptions']));
         $definition->addTag('kernel.event_listener', array('event' => 'kernel.exception', 'method' => 'onKernelException'));
         $container->setDefinition('php_airbrake.exception_listener', $definition);
         // PHP Shutdown Listener
         $class = $container->getParameter('eo_airbrake.shutdown_listener.class');
         $definition = new Definition($class, array(new Reference('eo_airbrake.client')));
         $definition->addTag('kernel.event_listener', array('event' => 'kernel.controller', 'method' => 'register'));
         $container->setDefinition('php_airbrake.shutdown_listener', $definition);
     }
 }
开发者ID:Foild,项目名称:EoAirbrakeBundle,代码行数:35,代码来源:EoAirbrakeExtension.php

示例7: testDbalLoadFromXmlMultipleConnections

 public function testDbalLoadFromXmlMultipleConnections()
 {
     $container = $this->getContainer();
     $loader = new DoctrineExtension();
     $container->registerExtension($loader);
     $loadXml = new XmlFileLoader($container, __DIR__ . '/Fixtures/config/xml');
     $loadXml->load('dbal_service_multiple_connections.xml');
     $loader->dbalLoad(array(), $container);
     $container->freeze();
     // doctrine.dbal.mysql_connection
     $arguments = $container->getDefinition('doctrine.dbal.mysql_connection')->getArguments();
     $config = $arguments[0];
     $this->assertEquals('mysql_s3cr3t', $config['password']);
     $this->assertEquals('mysql_user', $config['user']);
     $this->assertEquals('mysql_db', $config['dbname']);
     $this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']);
     // doctrine.dbal.sqlite_connection
     $arguments = $container->getDefinition('doctrine.dbal.sqlite_connection')->getArguments();
     $container = $this->getContainer();
     $loader = new DoctrineExtension();
     $container->registerExtension($loader);
     $loadXml = new XmlFileLoader($container, __DIR__ . '/Fixtures/config/xml');
     $loadXml->load('dbal_service_single_connection.xml');
     $loader->dbalLoad(array(), $container);
     $container->freeze();
     // doctrine.dbal.mysql_connection
     $arguments = $container->getDefinition('doctrine.dbal.mysql_connection')->getArguments();
     $config = $arguments[0];
     $this->assertEquals('mysql_s3cr3t', $config['password']);
     $this->assertEquals('mysql_user', $config['user']);
     $this->assertEquals('mysql_db', $config['dbname']);
     $this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']);
 }
开发者ID:spf13,项目名称:symfony,代码行数:33,代码来源:AbstractDoctrineExtensionTest.php

示例8: loadInternal

 protected function loadInternal(array $config, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $container->setAlias('bernard.driver', 'bernard.driver.' . $config['driver']);
     switch ($config['driver']) {
         case 'doctrine':
             $this->registerDoctrineConfiguration($config['options'], $container);
             break;
         case 'file':
             $this->registerFlatFileConfiguration($config['options'], $container);
             break;
         case 'phpamqp':
             $this->registerPhpAmqpConfiguration($config['options'], $container);
             break;
         case 'phpredis':
             $this->registerPhpRedisConfiguration($config['options'], $container);
             break;
         case 'predis':
             $this->registerPredisConfiguration($config['options'], $container);
             break;
         case 'ironmq':
             $this->registerIronMQConfiguration($config['options'], $container);
             break;
         case 'sqs':
             $this->registerSqsConfiguration($config['options'], $container);
             break;
     }
     $this->registerListeners($config['listeners'], $container);
 }
开发者ID:johanderuijter,项目名称:BernardBundle,代码行数:30,代码来源:BernardExtension.php

示例9: load

 /**
  * Load configuration.
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('controllers.xml');
     if (isset($config['serializer'])) {
         $container->setAlias('fos_js_routing.serializer', new Alias($config['serializer'], false));
     } else {
         $loader->load('serializer.xml');
     }
     $container->setAlias('fos_js_routing.router', new Alias($config['router'], false));
     $container->getDefinition('fos_js_routing.extractor')->replaceArgument(1, $config['routes_to_expose']);
     if (isset($config['request_context_base_url'])) {
         $container->setParameter('fos_js_routing.request_context_base_url', $config['request_context_base_url']);
     }
     if (isset($config['cache_control'])) {
         $config['cache_control']['enabled'] = true;
     } else {
         $config['cache_control'] = array('enabled' => false);
     }
     $container->setParameter('fos_js_routing.cache_control', $config['cache_control']);
 }
开发者ID:inoxis91,项目名称:Symfony2,代码行数:28,代码来源:FOSJsRoutingExtension.php

示例10: load

 /**
  * {@inheritdoc}
  */
 public function load(ContainerBuilder $container, array $config)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/services'));
     $loader->load('core.xml');
     $container->setParameter('behat.mailcatcher.client.url', $config['url']);
     $container->setParameter('behat.mailcatcher.purge_before_scenario', $config['purge_before_scenario']);
 }
开发者ID:daviddel,项目名称:mailcatcher,代码行数:10,代码来源:Extension.php

示例11: loadInternal

 public function loadInternal(array $config, ContainerBuilder $container)
 {
     $this->mergeNavigation($container, $config['navigation']);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('roles.xml');
 }
开发者ID:hikmahtiar6,项目名称:drafterbit,代码行数:7,代码来源:DrafterbitBlogExtension.php

示例12: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     // add custom form widgets
     $container->setParameter('twig.form.resources', array_merge($container->getParameter('twig.form.resources'), ['ZapoyokExtraFormBundle:Form:form_admin_fields.html.twig']));
 }
开发者ID:zapoyok,项目名称:extraform-bundle,代码行数:10,代码来源:ZapoyokExtraFormExtension.php

示例13: load

 /**
  * Responds to the doctrine_mongo_db configuration parameter.
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     // Load DoctrineMongoDBBundle/Resources/config/mongodb.xml
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('mongodb.xml');
     $processor = new Processor();
     $configuration = new Configuration($container->getParameter('kernel.debug'));
     $config = $processor->processConfiguration($configuration, $configs);
     // can't currently default this correctly in Configuration
     if (!isset($config['metadata_cache_driver'])) {
         $config['metadata_cache_driver'] = array('type' => 'array');
     }
     if (empty($config['default_connection'])) {
         $keys = array_keys($config['connections']);
         $config['default_connection'] = reset($keys);
     }
     if (empty($config['default_document_manager'])) {
         $keys = array_keys($config['document_managers']);
         $config['default_document_manager'] = reset($keys);
     }
     // set some options as parameters and unset them
     $config = $this->overrideParameters($config, $container);
     // load the connections
     $this->loadConnections($config['connections'], $container);
     // load the document managers
     $this->loadDocumentManagers($config['document_managers'], $config['default_document_manager'], $config['default_database'], $config['metadata_cache_driver'], $container);
     $this->loadConstraints($container);
 }
开发者ID:hellovic,项目名称:symfony,代码行数:31,代码来源:DoctrineMongoDBExtension.php

示例14: load

 /**
  * Loads a specific configuration.
  *
  * @param array            $config    An array of configuration values
  * @param ContainerBuilder $container A ContainerBuilder instance
  *
  * @throws \InvalidArgumentException When provided tag is not defined in this extension
  *
  * @api
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('event_listeners.xml');
     $loader->load('serializer.xml');
     $loader->load('api_controllers.xml');
 }
开发者ID:NadirZenith,项目名称:fametv,代码行数:17,代码来源:AppExtension.php

示例15: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(array(__DIR__ . '/../Resources/config')));
     $loader->load('services.xml');
     $container->setParameter('jms_i18n_routing.default_locale', $config['default_locale']);
     $container->setParameter('jms_i18n_routing.locales', $config['locales']);
     $container->setParameter('jms_i18n_routing.catalogue', $config['catalogue']);
     $container->setParameter('jms_i18n_routing.strategy', $config['strategy']);
     $this->addClassesToCompile(array($container->getDefinition('jms_i18n_routing.router')->getClass()));
     if ('prefix' === $config['strategy']) {
         $container->getDefinition('jms_i18n_routing.locale_choosing_listener')->setPublic(true)->addTag('kernel.event_listener', array('event' => 'kernel.exception', 'priority' => 128));
     }
     if ($config['hosts']) {
         $container->getDefinition('jms_i18n_routing.router')->addMethodCall('setHostMap', array($config['hosts']));
         $container->getDefinition('jms_i18n_routing.locale_changing_listener')->setPublic(true)->addTag('kernel.event_listener', array('event' => 'kernel.request', 'priority' => 120))->addArgument(array_flip($config['hosts']));
         $this->addClassesToCompile(array($container->getDefinition('jms_i18n_routing.locale_changing_listener')->getClass()));
     }
     // remove route extractor if JMSTranslationBundle is not enabled to avoid any problems
     $bundles = $container->getParameter('kernel.bundles');
     if (!isset($bundles['JMSTranslationBundle'])) {
         $container->removeDefinition('jms_i18n_routing.route_translation_extractor');
     }
 }
开发者ID:natxet,项目名称:JMSI18nRoutingBundle,代码行数:25,代码来源:JMSI18nRoutingExtension.php


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