The YAML format does not support anonymous services (cf. the XML loader).
Author: Fabien Potencier (fabien.potencier@symfony-project.com)
Inheritance: extends Symfony\Component\DependencyInjection\Loader\FileLoader
 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);
         }
     }
 }
 /**
  * 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");
 }
 /**
  * {@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']);
 }
 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");
 }
Ejemplo n.º 5
0
 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'));
 }
Ejemplo n.º 6
0
 /**
  * {@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');
 }
Ejemplo n.º 7
0
 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();
 }
 /**
  * {@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');
 }
 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');
 }
 /**
  * {@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());
 }
 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');
 }
 /**
  * {@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);
     }
 }
 /**
  * {@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));
     }
 }
 /**
  * {@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');
 }
 /**
  * {@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);
     }
 }
 /**
  * {@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');
             }
         }
     }
 }
 /**
  * {@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']);
 }
Ejemplo n.º 18
0
 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']);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     // ...
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     // ...
     $loader->load('admin.yml');
 }
 /**
  * {@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');
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     if (!isset($config['thread_per_page'])) {
         throw new \InvalidArgumentException('The "thread_per_page" option must be set in "yosimitso_working_forum"');
     }
     if (!isset($config['post_per_page'])) {
         throw new \InvalidArgumentException('The "post_per_page" option must be set in "yosimitso_working_forum"');
     }
     if (!isset($config['date_format'])) {
         throw new \InvalidArgumentException('The "post_per_page" option must be set in "yosimitso_working_forum"');
     }
     if (!isset($config['allow_anonymous_read'])) {
         throw new \InvalidArgumentException('The "allow_anonymous_read" option must be set in "yosimitso_working_forum"');
     }
     if (!isset($config['allow_moderator_delete_thread'])) {
         throw new \InvalidArgumentException('The "allow_moderator_delete_thread" option must be set in "yosimitso_working_forum"');
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $container->setParameter('yosimitso_working_forum.thread_per_page', $config['thread_per_page']);
     $container->setParameter('yosimitso_working_forum.post_per_page', $config['post_per_page']);
     $container->setParameter('yosimitso_working_forum.date_format', $config['date_format']);
     $container->setParameter('yosimitso_working_forum.allow_anonymous_read', $config['allow_anonymous_read']);
     $container->setParameter('yosimitso_working_forum.allow_moderator_delete_thread', $config['allow_moderator_delete_thread']);
 }
 /**
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $this->copyValuesFromParentToProject('locales', $config);
     $this->copyValuesFromParentToProject('domains', $config);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     if ($config['auto_add_assets']) {
         $loader->load('autoAdd.yml');
     }
     $container->setParameter('translation.toolbar.allow_edit', $config['allow_edit']);
     /*
      * Set an alias for the adapter
      */
     $adapter = $config['http_adapter'];
     if ($adapter === 'guzzle5' || $adapter === 'guzzle6') {
         //Use one of our adapters
         $adapter = 'happyr.translation.http_adapter.' . $adapter;
     }
     $container->setAlias('happyr.translation.http_adapter', $adapter);
     $targetDir = rtrim($config['target_dir'], '/');
     $container->findDefinition('happyr.translation.filesystem')->replaceArgument(2, $targetDir);
     /*
      * Set alias for the translation service
      */
     $container->setAlias('happyr.translation', 'happyr.translation.service.' . $config['translation_service']);
     $container->findDefinition('happyr.translation.service.loco')->replaceArgument(2, $config['projects'])->replaceArgument(3, $targetDir);
 }
Ejemplo n.º 23
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('form_type.yml');
     $this->addClassesToCompile(['Oro\\Bundle\\DataAuditBundle\\EventListener\\KernelListener']);
 }
 /**
  * {@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 (isset($config['return_transfer'])) {
         $container->setParameter('anchovy_curl.return_transfer', $config['return_transfer']);
     }
     if (isset($config['follow_location'])) {
         $container->setParameter('anchovy_curl.follow_location', $config['follow_location']);
     }
     if (isset($config['max_redirects'])) {
         $container->setParameter('anchovy_curl.max_redirects', $config['max_redirects']);
     }
     if (isset($config['timeout'])) {
         $container->setParameter('anchovy_curl.timeout', $config['timeout']);
     }
     if (isset($config['connect_timeout'])) {
         $container->setParameter('anchovy_curl.connect_timeout', $config['connect_timeout']);
     }
     if (isset($config['http_header'])) {
         $container->setParameter('anchovy_curl.http_header', $config['http_header']);
     }
     if (isset($config['crlf'])) {
         $container->setParameter('anchovy_curl.crlf', $config['crlf']);
     }
     if (isset($config['ssl_version'])) {
         $container->setParameter('anchovy_curl.ssl_version', $config['ssl_version']);
     }
     if (isset($config['ssl_verify'])) {
         $container->setParameter('anchovy_curl.ssl_verify', $config['ssl_verify']);
     }
 }
Ejemplo n.º 25
0
 public function build(ContainerBuilder $container)
 {
     // register the extension(s) found in DependencyInjection/ directory
     parent::build($container);
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config'));
     $loader->load('services.yml');
 }
 /**
  * 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)
 {
     $config = $this->processConfiguration(new Configuration(), $config);
     $container->setParameter('page_actions.resources', $config['resources']);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
 /**
  * Load serializer related configuration
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 protected function loadSerializerConfig(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/serializer'));
     $loader->load('flat.yml');
     $loader->load('serializer.yml');
     $loader->load('structured.yml');
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('fixture_loader.yml');
     $loader->load('services.yml');
     $this->addInstallerDataFiles($container);
 }
 /**
  * {@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');
 }
Ejemplo n.º 30
0
 public function load(array $config, ContainerBuilder $container)
 {
     // we load all services
     $loaderYaml = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/service'));
     $loaderYaml->load('services.yml');
     $loaderYaml->load('services_util.yml');
     $loaderYaml->load('services_twig_extension.yml');
     // we load config
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $config);
     /**
      * Mail config parameter
      */
     if (isset($config['mail'])) {
         if (isset($config['mail']['overloading_mail'])) {
             $container->setParameter('sfynx.tool.mail.overloading_mail', $config['mail']['overloading_mail']);
         } else {
             $container->setParameter('sfynx.tool.mail.overloading_mail', '');
         }
     }
     /**
      * Date config parameter
      */
     if (isset($config['date']['cache_file'])) {
         $container->setParameter('sfynx.tool.date.cache_file', $config['date']['cache_file']);
     }
     /**
      * LayoutHead config parameter
      */
     $container->setParameter('js_files', array());
     $container->setParameter('css_files', array());
 }