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


PHP Loader\YamlFileLoader类代码示例

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


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

示例1: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $config = array();
     foreach ($configs as $subConfig) {
         $config = array_merge($config, $subConfig);
     }
     foreach ($config['email'] as $alias => $options) {
         $optionId = sprintf('rage_notification.email.%s.message', $alias);
         $optionDef = new Definition($container->getParameter('rage_notification.email_message.class'));
         $optionDef->setShared(false);
         $optionDef->addArgument(new Reference('mailer'));
         $optionDef->addArgument(new Reference('templating'));
         if (!empty($options['from'])) {
             $optionDef->addMethodCall('setFrom', [$options['from']]);
         }
         if (!empty($options['reply_to'])) {
             $optionDef->addMethodCall('setReplyTo', [$options['reply_to']]);
         }
         if (!empty($options['embed_images'])) {
             $optionDef->addMethodCall('setEmbedImages', [$options['embed_images']['url'], $options['embed_images']['path']]);
         }
         if (!empty($options['template_path'])) {
             $optionDef->addMethodCall('setTemplatePath', [$options['template_path']]);
         }
         if (!empty($options['css_file'])) {
             $optionDef->addMethodCall('setCssFile', [$options['css_file']]);
         }
         $container->setDefinition($optionId, $optionDef);
         if ($alias === 'default') {
             $container->setAlias('rage_notification.email.message', $optionId);
         }
     }
 }
开发者ID:ragephp,项目名称:notification-bundle,代码行数:35,代码来源:RageNotificationExtension.php

示例2: load

 /**
  * Loads a specific configuration.
  *
  * @param array $configs 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 $configs, ContainerBuilder $container)
 {
     // Loading configuration from Core/settings
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../../Publish/Core/settings'));
     $loader->load('indexable_fieldtypes.yml');
     $loader->load("storage_engines/legacy_solr.yml");
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:17,代码来源:EzPublishSolrExtension.php

示例3: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
     $loader->load('services.yml');
     $loader->load('owners.yml');
     $processor = new Processor();
     $config = $processor->processConfiguration(new Configuration(), $configs);
     $container->getDefinition('glory_oauth.oauth_manager')->addMethodCall('setOAuthClass', array($config['oauth_class']));
     // setup http client settings
     $httpClient = $container->getDefinition('glory_oauth.http_client');
     $httpClient->addMethodCall('setVerifyPeer', array($config['http_client']['verify_peer']));
     $httpClient->addMethodCall('setTimeout', array($config['http_client']['timeout']));
     $httpClient->addMethodCall('setMaxRedirects', array($config['http_client']['max_redirects']));
     $httpClient->addMethodCall('setIgnoreErrors', array($config['http_client']['ignore_errors']));
     if (isset($config['http_client']['proxy']) && $config['http_client']['proxy'] != '') {
         $httpClient->addMethodCall('setProxy', array($config['http_client']['proxy']));
     }
     // setup services for all configured resource owners
     foreach ($config['owners'] as $name => $options) {
         $this->createOwnerService($container, $name, $options);
     }
     // check of the connect controllers etc should be enabled
     $container->setParameter('glory_oauth.auto_register', $config['auto_register']);
     $container->setAlias('glory_oauth.connect', $config['connect']);
 }
开发者ID:foreverglory,项目名称:oauth-bundle,代码行数:28,代码来源:GloryOAuthExtension.php

示例4: loadExamples

 protected function loadExamples(ContainerBuilder $container)
 {
     $xmlloader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/examples'));
     $yamlloader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/examples'));
     $yamlloader->load("example_menu.yml");
     $xmlloader->load("example_navbar.xml");
 }
开发者ID:rdohms,项目名称:MopaBootstrapBundle,代码行数:7,代码来源:MopaBootstrapExtension.php

示例5: test_controller_resolver

 public function test_controller_resolver()
 {
     $container = new ContainerBuilder();
     // YamlFileLoader only uses one path at a time, so we need to loop
     // through all of the ones we are using.
     foreach (array(__DIR__ . '/config', __DIR__ . '/ext/vendor2/foo/config') as $path) {
         $loader = new YamlFileLoader($container, new FileLocator($path));
         $loader->load('services.yml');
     }
     // Autoloading classes within the tests folder does not work
     // so I'll include them manually.
     if (!class_exists('vendor2\\foo\\controller')) {
         include __DIR__ . '/ext/vendor2/foo/controller.php';
     }
     if (!class_exists('phpbb\\controller\\foo')) {
         include __DIR__ . '/phpbb/controller/foo.php';
     }
     $resolver = new \phpbb\controller\resolver($container, dirname(__FILE__) . '/');
     $symfony_request = new Request();
     $symfony_request->attributes->set('_controller', 'foo.controller:handle');
     $this->assertEquals($resolver->getController($symfony_request), array(new foo\controller(), 'handle'));
     $symfony_request = new Request();
     $symfony_request->attributes->set('_controller', 'core_foo.controller:bar');
     $this->assertEquals($resolver->getController($symfony_request), array(new phpbb\controller\foo(), 'bar'));
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:25,代码来源:controller_test.php

示例6: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     //admin menu
     $configs = $this->addMenuItemsByBundles($container, $config);
     $container->setParameter('core.admin_menus', $configs);
     //google analytics
     if (isset($config['apis']['google_analytics']['options']['application_name'])) {
         $container->setParameter('google_analytics.application_name', $config['apis']['google_analytics']['options']['application_name']);
     }
     if (isset($config['apis']['google_analytics']['options']['oauth2_client_id'])) {
         $container->setParameter('google_analytics.oauth2_client_id', $config['apis']['google_analytics']['options']['oauth2_client_id']);
     }
     if (isset($config['apis']['google_analytics']['options']['oauth2_client_secret'])) {
         $container->setParameter('google_analytics.oauth2_client_secret', $config['apis']['google_analytics']['options']['oauth2_client_secret']);
     }
     if (isset($config['apis']['google_analytics']['options']['oauth2_redirect_uri'])) {
         $container->setParameter('google_analytics.oauth2_redirect_uri', $config['apis']['google_analytics']['options']['oauth2_redirect_uri']);
     }
     if (isset($config['apis']['google_analytics']['options']['developer_key'])) {
         $container->setParameter('google_analytics.developer_key', $config['apis']['google_analytics']['options']['developer_key']);
     }
     if (isset($config['apis']['google_analytics']['options']['site_name'])) {
         $container->setParameter('google_analytics.site_name', $config['apis']['google_analytics']['options']['site_name']);
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
开发者ID:sebardo,项目名称:admin,代码行数:32,代码来源:AdminExtension.php

示例7: setUpContainer

 private function setUpContainer()
 {
     $this->set('core.http.symfony_request', $this->symfonyRequest);
     $this->set('core.environment.application_path', $this->applicationPath);
     $this->setParameter('core.environment', $this->applicationMode);
     $this->addCompilerPass(new RegisterListenersPass('core.event_dispatcher', 'core.eventListener', 'core.eventSubscriber'));
     $this->addCompilerPass(new RegisterSmartyPluginsPass());
     $this->addCompilerPass(new RegisterColumnRendererPass());
     $this->addCompilerPass(new RegisterValidationRulesPass());
     $this->addCompilerPass(new RegisterWysiwygEditorsCompilerPass());
     $this->addCompilerPass(new RegisterColumnTypesCompilerPass());
     $loader = new YamlFileLoader($this, new FileLocator(__DIR__));
     $loader->load($this->applicationPath->getClassesDir() . 'config/services.yml');
     $loader->load($this->applicationPath->getClassesDir() . 'View/Renderer/Smarty/config/services.yml');
     // Try to get all available services
     /** @var Modules $modules */
     $modules = $this->get('core.modules');
     $availableModules = $this->allModules === true ? $modules->getAllModules() : $modules->getActiveModules();
     $vendors = $this->get('core.modules.vendors')->getVendors();
     foreach ($availableModules as $module) {
         foreach ($vendors as $vendor) {
             $modulePath = $this->applicationPath->getModulesDir() . $vendor . '/' . $module['dir'];
             $path = $modulePath . '/Resources/config/services.yml';
             if (is_file($path)) {
                 $loader->load($path);
             }
             $this->registerCompilerPass($vendor, $module['dir']);
         }
     }
     $this->compile();
 }
开发者ID:acp3,项目名称:core,代码行数:31,代码来源:ServiceContainerBuilder.php

示例8: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('fieldtypes.yml');
     $loader->load('templating.yml');
 }
开发者ID:obenyoussef,项目名称:metalfrance,代码行数:10,代码来源:MetalFranceSiteExtension.php

示例9: load

 public function load(array $configs, ContainerBuilder $container)
 {
     //$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     //$loader->load('services.xml');
     $yamlFileLoader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $yamlFileLoader->load('applications.yml');
 }
开发者ID:mapbender,项目名称:query-builder,代码行数:7,代码来源:MapbenderQueryBuilderExtension.php

示例10: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('slots.yml');
     $loader->load('default_settings.yml');
     if (isset($config['api_endpoint'])) {
         $container->setParameter('ez_recommendation.api_endpoint', $config['api_endpoint']);
     }
     if (isset($config['recommender']['api_endpoint'])) {
         $container->setParameter('ez_recommendation.recommender.api_endpoint', $config['recommender']['api_endpoint']);
     }
     if (isset($config['recommender']['consume_timeout'])) {
         $container->setParameter('ez_recommendation.recommender.consume_timeout', $config['recommender']['consume_timeout']);
     }
     if (isset($config['tracking']['script_url'])) {
         $container->setParameter('ez_recommendation.tracking.script_url', $config['tracking']['script_url']);
     }
     if (isset($config['tracking']['api_endpoint'])) {
         $container->setParameter('ez_recommendation.tracking.api_endpoint', $config['tracking']['api_endpoint']);
     }
     $processor = new ConfigurationProcessor($container, 'ez_recommendation');
     $processor->mapConfig($config, new ConfigurationMapper());
 }
开发者ID:krzyraj,项目名称:EzSystemsRecommendationBundle,代码行数:29,代码来源:EzSystemsRecommendationExtension.php

示例11: load

 public function load(array $config, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator());
     $loader->load(__DIR__ . '/../Resources/config/services.yml');
     // this is the goal: dynamically set this "main_parser" service alias
     $container->setAlias('main_parser', 'bruno_parser_service');
 }
开发者ID:weaverryan,项目名称:simple-bundle-config-example,代码行数:7,代码来源:BrunoSculpinExtension.php

示例12: load

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

示例13: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     /**
      * Load definitions
      */
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $servers = $config['servers'];
     $container->setParameter('laelaps_gearman.servers', $servers);
     /**
      * Build container, if array, add multiple servers, if string add one
      */
     $gearmanClientDefinition = $container->getDefinition('laelaps.gearman.client');
     $gearmanWorkerDefinition = $container->getDefinition('laelaps.gearman.worker');
     if (is_array($servers)) {
         foreach ($servers as $server) {
             list($host, $port) = explode(':', $server);
             $gearmanClientDefinition->addMethodCall('addServer', array($host, $port));
             $gearmanWorkerDefinition->addMethodCall('addServer', array($host, $port));
         }
     } else {
         $gearmanClientDefinition->addMethodCall('addServers', array($servers));
         $gearmanWorkerDefinition->addMethodCall('addServers', array($servers));
     }
 }
开发者ID:isometriks,项目名称:symfony-gearman-bundle,代码行数:30,代码来源:LaelapsGearmanExtension.php

示例14: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $factory = new UserServicesFactory($container);
     // The first parameter is the name of the user-system, the second is the configuration which internally
     // is normalized by the Symfony Config component.
     /*
         The `UserServicesFactory::create()` will also register the form-types you need,
         any form-type/name/class that belongs to the FOSUserBundle will be converted to an ready
         to use form-type. Remember form types and names start with the service-prefix of the user-system.
     
         ```
         'form' => array(
             'type' => 'fos_user_profile',
             'class' => 'FOS\UserBundle\Form\Type\ProfileFormType',
             'name' => 'fos_user_profile_form',
         ),
         ```
     
         Will internally get converted to an 'image_store_user_profile' form-type service definition.
         Never set the template namespace to FOSUserBundle or RollerworksMultiUserBundle as this will create an endless recursion!
     */
     $factory->create('image_store_user', array(array('path' => '^/', 'host' => null, 'request_matcher' => null, 'services_prefix' => 'image_store_user', 'routes_prefix' => 'image_store_user', 'db_driver' => 'orm', 'model_manager_name' => 'default', 'use_listener' => true, 'user_class' => 'ImageStore\\Bundle\\UserBundle\\Entity\\User', 'firewall_name' => 'main', 'use_username_form_type' => true, 'from_email' => array('address' => null, 'sender_name' => null), 'security' => array('login' => array('template' => 'RollerworksMultiUserBundle:UserBundle/Security:login.html.twig')), 'service' => array('mailer' => 'fos_user.mailer.default', 'email_canonicalizer' => 'fos_user.util.canonicalizer.default', 'username_canonicalizer' => 'fos_user.util.canonicalizer.default', 'user_manager' => 'fos_user.user_manager.default'), 'template' => array('layout' => 'RollerworksMultiUserBundle::layout.html.twig'), 'profile' => array('form' => array('class' => 'FOS\\UserBundle\\Form\\Type\\ProfileFormType', 'type' => 'fos_user_profile', 'name' => 'fos_user_profile_form', 'validation_groups' => array('Profile', 'Default')), 'template' => array('edit' => 'RollerworksMultiUserBundle:UserBundle/Profile:edit.html.twig', 'show' => 'RollerworksMultiUserBundle:UserBundle/Profile:show.html.twig')), 'change_password' => array('form' => array('class' => 'FOS\\UserBundle\\Form\\Type\\ChangePasswordFormType', 'type' => 'fos_user_change_password', 'name' => 'fos_user_change_password_form', 'validation_groups' => array('ChangePassword', 'Default')), 'template' => array('change_password' => 'RollerworksMultiUserBundle:UserBundle/ChangePassword:changePassword.html.twig')), 'registration' => array('confirmation' => array('enabled' => false, 'template' => array('email' => 'RollerworksMultiUserBundle:UserBundle/Registration:email.txt.twig', 'confirmed' => 'RollerworksMultiUserBundle:UserBundle/Registration:confirmed.html.twig'), 'from_email' => array('address' => null, 'sender_name' => null)), 'form' => array('class' => 'FOS\\UserBundle\\Form\\Type\\RegistrationFormType', 'type' => 'fos_user_registration', 'name' => 'fos_user_registration_form', 'validation_groups' => array('Registration', 'Default')), 'template' => array('register' => 'RollerworksMultiUserBundle:UserBundle/Registration:register.html.twig', 'check_email' => 'RollerworksMultiUserBundle:UserBundle/Registration:checkEmail.html.twig')), 'resetting' => array('token_ttl' => 86400, 'email' => array('from_email' => array('address' => null, 'sender_name' => null)), 'form' => array('template' => null, 'class' => 'FOS\\UserBundle\\Form\\Type\\ResettingFormType', 'type' => 'fos_user_resetting', 'name' => 'fos_user_resetting_form', 'validation_groups' => array('ResetPassword', 'Default')), 'template' => array('check_email' => 'RollerworksMultiUserBundle:UserBundle/Resetting:checkEmail.html.twig', 'email' => 'RollerworksMultiUserBundle:UserBundle/Resetting:email.txt.twig', 'password_already_requested' => 'RollerworksMultiUserBundle:UserBundle/Resetting:passwordAlreadyRequested.html.twig', 'request' => 'RollerworksMultiUserBundle:UserBundle/Resetting:request.html.twig', 'reset' => 'RollerworksMultiUserBundle:UserBundle/Resetting:reset.html.twig'))), $config));
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
开发者ID:dunght163,项目名称:image-store,代码行数:30,代码来源:ImageStoreUserExtension.php

示例15: load

 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $data = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('remote_media.yml');
     $container->setParameter('remote_media.cdn.s3.bucket', $data['cdn']['s3']['bucket']);
     $container->setParameter('remote_media.cdn.s3.region', $data['cdn']['s3']['region']);
     $container->setParameter('remote_media.cdn.s3.access_key', $data['cdn']['s3']['access_key']);
     $container->setParameter('remote_media.cdn.s3.access_secret', $data['cdn']['s3']['access_secret']);
     $mediaUrl = $data['cdn']['media_url'];
     if (null === $mediaUrl) {
         $mediaUrl = sprintf('https://%s.s3-%s.amazonaws.com', $data['cdn']['s3']['bucket'], $data['cdn']['s3']['region']);
     }
     $container->setParameter('remote_media.cdn.media_url', $mediaUrl);
     $cachePrefix = $data['cdn']['cache_prefix'];
     if (null === $cachePrefix) {
         $env = $container->getParameter('kernel.environment');
         $cachePrefix = "prod" === $env ? "" : "{$env}/";
     }
     $container->setParameter('remote_media.cdn.cache_prefix', $cachePrefix);
     if (isset($data['cdn']['cache_provider'])) {
         $this->setupCacheProvider($data['cdn']['cache_provider'], $container);
     }
 }
开发者ID:arsthanea,项目名称:remote-media-bundle,代码行数:28,代码来源:RemoteMediaExtension.php


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