php Symfony-Component-DependencyInjection-Loader-YamlFileLoader类(方法)实例源码

下面列出了php Symfony-Component-DependencyInjection-Loader-YamlFileLoader 类(方法)源码代码实例,从而了解它的用法。

作者:rageph    项目:notification-bundl   
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);
         }
     }
 }

作者:CG7    项目:ezpublish-kerne   
/**
  * 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");
 }

作者:foreverglor    项目:oauth-bundl   
/**
  * {@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']);
 }

作者:rdohm    项目:MopaBootstrapBundl   
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");
 }

作者:phpb    项目:phpb   
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'));
 }

作者:sebard    项目:admi   
/**
  * {@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');
 }

作者:acp    项目:cor   
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();
 }

作者:obenyousse    项目:metalfranc   
/**
  * {@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');
 }

作者:mapbende    项目:query-builde   
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');
 }

作者:krzyra    项目:EzSystemsRecommendationBundl   
/**
  * {@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());
 }

作者:weaverrya    项目:simple-bundle-config-exampl   
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');
 }

作者:ChrisWesterfiel    项目:MJR.ONE-C   
/**
  * {@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);
     }
 }

作者:isometrik    项目:symfony-gearman-bundl   
/**
  * {@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));
     }
 }

作者:dunght16    项目:image-stor   
/**
  * {@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');
 }

作者:arsthane    项目:remote-media-bundl   
/**
  * {@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);
     }
 }

作者:Zimtroni    项目:ZimBannerBundl   
/**
  * {@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');
     if (array_key_exists('incident', $config)) {
         $container->setParameter('zimban.incident.lifetime', $config['incident']['lifetime']);
     }
     if (array_key_exists('banner', $config)) {
         $container->setParameter('zimban.banner.incidents_to_ban', $config['banner']['incidents_to_ban']);
         $container->setParameter('zimban.banner.ban_time_frame', $config['banner']['ban_time_frame']);
     }
     if (array_key_exists('enabled', $config)) {
         if ($container->hasDefinition('zimban.listener.security_hook_listener')) {
             $definition = $container->getDefinition('zimban.listener.security_hook_listener');
             if (!$definition->hasTag('kernel.event_subscriber') && $config['enabled']) {
                 $definition->addTag('kernel.event_subscriber', array());
             }
             if (!$config['enabled']) {
                 $container->removeDefinition('zimban.listener.security_hook_listener');
             }
         }
     }
 }

作者:hyrmedi    项目:KunstmaanBundlesCM   
/**
  * {@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');
     foreach ($config['actions'] as $key => $value) {
         if ($value['max_number_by_ip']) {
             $definition = new Definition('Kunstmaan\\VotingBundle\\EventListener\\Security\\MaxNumberByIpEventListener');
             $definition->addArgument(new Reference('kunstmaan_voting.services.repository_resolver'));
             $definition->addArgument($value['max_number_by_ip']);
             $definition->addTag('kernel.event_listener', array('event' => 'kunstmaan_voting.' . lcfirst(ContainerBuilder::camelize($key)), 'method' => 'onVote', 'priority' => 100));
             $container->setDefinition('kunstmaan_voting.security.' . $key . '.max_number_by_ip_event_listener', $definition);
         }
     }
     $possibleActions = array('up_vote', 'down_vote', 'facebook_like', 'facebook_send', 'linkedin_share');
     $votingDefaultValue = $config['voting_default_value'];
     // If the user overwrites the voting_default_value in paramters file, we use this one
     if ($container->hasParameter('voting_default_value')) {
         $votingDefaultValue = $container->getParameter('voting_default_value');
     }
     // When no values are defined, initialize with defaults
     foreach ($possibleActions as $action) {
         if (!isset($config['actions'][$action]) || !is_array($config['actions'][$action])) {
             $config['actions'][$action]['default_value'] = $action == 'down_vote' ? -1 * $votingDefaultValue : $votingDefaultValue;
         }
     }
     $container->setParameter('kuma_voting.actions', $config['actions']);
 }

作者:hidenorigot    项目:symfony2-boo   
public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $config = $this->processConfiguration(new Configuration(), $configs);
     $this->buildMemberCollectionDefinition($container, $config['members']);
 }

作者:WildCodeSchoo    项目:projet-noblesceau   
public function load(array $configs, ContainerBuilder $container)
 {
     // ...
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     // ...
     $loader->load('admin.yml');
 }

作者:agentsi    项目:crontab-bundl   
/**
  * {@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(sprintf('services.%s.yml', $config['db_driver']));
     $container->setParameter($this->getAlias() . '.db_driver', $config['db_driver']);
     $container->setParameter($this->getAlias() . '.model_manager_name', $config['model_manager_name']);
     $container->setParameter($this->getAlias() . '.cronjob_class', $config['cronjob_class']);
     $container->setParameter($this->getAlias() . '.cronjob_console', $config['cronjob_console']);
     $container->setParameter($this->getAlias() . '.logs_path', $config['logs_path']);
     if ('orm' === $config['db_driver']) {
         $managerService = $this->getAlias() . '.entity_manager';
         $doctrineService = 'doctrine';
     } else {
         $managerService = '';
         $doctrineService = '';
     }
     $definition = $container->getDefinition($managerService);
     if (method_exists($definition, 'setFactory')) {
         $definition->setFactory(array(new Reference($doctrineService), 'getManager'));
     } else {
         $definition->setFactoryService($doctrineService);
         $definition->setFactoryMethod('getManager');
     }
     $container->setAlias($this->getAlias() . '.manager', $config['crontab_manager']);
     $definition = $container->getDefinition($config['crontab_manager']);
     $definition->addMethodCall('registryConfigCronjobs', array($config['jobs']));
     $loader->load('services.yml');
 }


问题


面经


文章

微信
公众号

扫码关注公众号