當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。