load() public method

public load ( $resource, $type = null )
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $params = ['defaults' => ['headers' => ['User-Agent' => $config['user_agent']]], 'emitter' => new Reference('ricbra_discogs.emitter')];
     $emitterDefinition = $container->getDefinition('ricbra_discogs.emitter');
     $clientDefinition = $container->getDefinition('discogs');
     $clientDefinition->replaceArgument(0, $params);
     if ($config['throttle']['enabled']) {
         $throttleDefinition = $container->getDefinition('ricbra_discogs.subscriber.throttle_subscriber');
         $throttleDefinition->replaceArgument(0, $config['throttle']['microseconds']);
         $emitterDefinition->addMethodCall('attach', [new Reference('ricbra_discogs.subscriber.throttle_subscriber')]);
     }
     if ($config['oauth']['enabled']) {
         $loader->load('oauth.xml');
         $subscriber = $container->getDefinition('ricbra_discogs.subscriber.oauth');
         $subscriber->replaceArgument(0, $config['oauth']['consumer_key']);
         $subscriber->replaceArgument(1, $config['oauth']['consumer_secret']);
         $factory = $container->getDefinition('ricbra_discogs.oauth_subscriber_factory');
         $factory->replaceArgument(0, new Reference($config['oauth']['token_provider_id']));
         $emitterDefinition->addMethodCall('attach', [new Reference('ricbra_discogs.subscriber.oauth')]);
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     if (!in_array(strtolower($config['db_driver']), array('orm'))) {
         throw new \InvalidArgumentException(sprintf('Invalid database driver (bait_poll.db_driver) "%s".', $config['db_driver']));
     }
     $loader->load(sprintf('%s.xml', $config['db_driver']));
     $container->setParameter('bait_poll.model_manager_name', $config['model_manager_name']);
     $container->setParameter('bait_poll.form.type', $config['form']['type']);
     $container->setParameter('bait_poll.form.name', $config['form']['name']);
     $container->setAlias('bait_poll.form.factory', $config['form']['factory']);
     $container->setParameter('bait_poll.poll.class', $config['poll']['class']);
     $container->setParameter('bait_poll.field.class', $config['field']['class']);
     $container->setParameter('bait_poll.vote.class', $config['vote']['class']);
     $container->setParameter('bait_poll.form.template', $config['form']['template']);
     $container->setParameter('bait_poll.form.theme', $config['form']['theme']);
     $container->setAlias('bait_poll.vote.manager', $config['vote']['manager']);
     $container->setAlias('bait_poll.poll.manager', $config['poll']['manager']);
     $loader->load('form.xml');
     $container->setParameter('bait_poll.cookie.prefix', $config['cookie']['prefix']);
     $container->setParameter('bait_poll.cookie.duration', $config['cookie']['duration']);
     $loader->load('poll.xml');
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $this->bindParameters($container, $this->getAlias(), $config);
     // Fallback for missing intl extension
     $intlExtensionInstalled = extension_loaded('intl');
     $container->setParameter('lunetics_locale.intl_extension_installed', $intlExtensionInstalled);
     $iso3166 = array();
     $iso639one = array();
     $iso639two = array();
     $localeScript = array();
     if (!$intlExtensionInstalled) {
         $yamlParser = new YamlParser();
         $file = new FileLocator(__DIR__ . '/../Resources/config');
         $iso3166 = $yamlParser->parse(file_get_contents($file->locate('iso3166-1-alpha-2.yml')));
         $iso639one = $yamlParser->parse(file_get_contents($file->locate('iso639-1.yml')));
         $iso639two = $yamlParser->parse(file_get_contents($file->locate('iso639-2.yml')));
         $localeScript = $yamlParser->parse(file_get_contents($file->locate('locale_script.yml')));
     }
     $container->setParameter('lunetics_locale.intl_extension_fallback.iso3166', $iso3166);
     $mergedValues = array_merge($iso639one, $iso639two);
     $container->setParameter('lunetics_locale.intl_extension_fallback.iso639', $mergedValues);
     $container->setParameter('lunetics_locale.intl_extension_fallback.script', $localeScript);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('validator.xml');
     $loader->load('guessers.xml');
     $loader->load('services.xml');
     $loader->load('switcher.xml');
     $loader->load('form.xml');
     if (!$config['strict_match']) {
         $container->removeDefinition('lunetics_locale.best_locale_matcher');
     }
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('form.xml');
     $loader->load('manager.xml');
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('connectors.xml');
     $loader->load('services.xml');
     // Listen service
     $container->getDefinition('ndewez.events.listener')->addArgument($config['events']);
     // Connector mock
     if (true === $config['mock']) {
         $this->setConnector($container, $container->getDefinition('ndewez.events.connector.mock'));
         return;
     }
     if (!isset($config['connection'])) {
         return;
     }
     // Connector synchronous
     if (ConnectorInterface::MODE_SYNCH === $config['mode']) {
         $connector = $container->getDefinition('ndewez.events.connector.http');
         $connector->replaceArgument(0, $config['connection']['host']);
         $this->setConnector($container, $connector);
         return;
     }
     // Connector asynchronous
     $connector = $container->getDefinition('ndewez.events.connector.amqp');
     $connector->replaceArgument(0, $config['connection']['host'])->replaceArgument(1, $config['connection']['port'])->replaceArgument(2, $config['connection']['user'])->replaceArgument(3, $config['connection']['password'])->replaceArgument(4, $config['connection']['application_code']);
     $this->setConnector($container, $connector);
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     foreach (array('services', 'form') as $service) {
         $loader->load(sprintf('%s.xml', $service));
     }
     if ($config['service'] == 's3') {
         $loader->load('s3.xml');
     } else {
         $loader->load('connector.xml');
     }
     switch ($config['service']) {
         case 'php':
             $container->setAlias('jonlil_ckfinder.connector', 'jonlil.ckfinder.connector.php');
             break;
         case 's3':
             $container->setAlias('jonlil_ckfinder.connector', 'jonlil.ckfinder.connector.s3');
             $container->setParameter('jonlil_ckfinder.amazon', array('secret' => $config['secret'], 'bucket' => $config['bucket'], 'access_key' => $config['accessKey'], 'base_url' => $config['baseUrl'], 'base_dir' => $config['baseDir'], 'thumbnails_file' => $config['thumbnailsFile'], 'thumbnails_enabled' => $config['thumbnailsEnabled'], 'direct_access' => $config['directAccess'], 'file_delete' => $config['fileDelete'], 'file_rename' => $config['fileRename'], 'file_upload' => $config['fileUpload'], 'file_view' => $config['fileView'], 'folder_delete' => $config['folderDelete'], 'folder_rename' => $config['folderRename'], 'folder_create' => $config['folderCreate'], 'folder_view' => $config['folderView']));
             $container->setParameter('jonlil_ckfinder.baseDir', $config['baseDir']);
             break;
     }
     $container->setParameter('jonlil_ckfinder.license', array('key' => $config['license']['key'], 'name' => $config['license']['name']));
     $container->setParameter('jonlil_ckfinder.baseUrl', $config['baseUrl']);
     $container->setParameter('twig.form.resources', array_merge($container->getParameter('twig.form.resources'), array('JonlilCKFinderBundle:Form:ckfinder_widget.html.twig')));
 }
 public function loadInternal(array $config, ContainerBuilder $container)
 {
     $this->mergeNavigation($container, $config['navigation']);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('roles.xml');
 }
Ejemplo n.º 8
0
 /**
  * Loads the web profiler configuration.
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('profiler.xml');
     $container->setParameter('web_profiler.debug_toolbar.position', $config['position']);
     if ($config['toolbar'] || $config['intercept_redirects']) {
         $loader->load('toolbar.xml');
         $container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(5, $config['excluded_ajax_paths']);
         $container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
         $container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
     }
     $baseDir = array();
     $rootDir = $container->getParameter('kernel.root_dir');
     $rootDir = explode(DIRECTORY_SEPARATOR, realpath($rootDir) ?: $rootDir);
     $bundleDir = explode(DIRECTORY_SEPARATOR, __DIR__);
     for ($i = 0; isset($rootDir[$i], $bundleDir[$i]); ++$i) {
         if ($rootDir[$i] !== $bundleDir[$i]) {
             break;
         }
         $baseDir[] = $rootDir[$i];
     }
     $baseDir = implode(DIRECTORY_SEPARATOR, $baseDir);
     $profilerController = $container->getDefinition('web_profiler.controller.profiler');
     $profilerController->replaceArgument(6, $baseDir);
     $fileLinkFormatter = $container->getDefinition('debug.file_link_formatter');
     $fileLinkFormatter->replaceArgument(2, $baseDir);
 }
 /**
  * Loads the product configuration.
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $bundles = $container->getParameter('kernel.bundles');
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('block.xml');
     $loader->load('product.xml');
     $loader->load('orm.xml');
     $loader->load('form.xml');
     $loader->load('twig.xml');
     $loader->load('menu.xml');
     if (isset($bundles['FOSRestBundle']) && isset($bundles['NelmioApiDocBundle'])) {
         $loader->load('api_controllers.xml');
         $loader->load('api_form.xml');
         $loader->load('serializer.xml');
     }
     if (isset($bundles['SonataAdminBundle'])) {
         $loader->load('admin.xml');
     }
     $pool = $container->getDefinition('sonata.product.pool');
     // this value is altered by the AddProductProviderPass class
     $pool->addMethodCall('__hack', $config['products']);
     $this->registerParameters($container, $config);
     $this->registerDoctrineMapping($config);
     $this->registerSeoParameters($container, $config);
 }
Ejemplo n.º 10
0
 /**
  * {@inheritdoc}
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $config);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load(sprintf('driver/%s.xml', $config['driver']));
     $this->registerResources('sylius', $config['driver'], $config['resources'], $container);
     $configFiles = ['services.xml'];
     foreach ($configFiles as $configFile) {
         $loader->load($configFile);
     }
     $factoryDefinition = new Definition(Factory::class);
     $factoryDefinition->setArguments([new Parameter('sylius.model.taxonomy.class')]);
     $translatableFactoryDefinition = $container->getDefinition('sylius.factory.taxonomy');
     $taxonomyFactoryClass = $translatableFactoryDefinition->getClass();
     $translatableFactoryDefinition->setClass(TranslatableFactory::class);
     $translatableFactoryDefinition->setArguments([$factoryDefinition, new Reference('sylius.translation.locale_provider')]);
     $decoratedTaxonomyFactoryDefinition = new Definition($taxonomyFactoryClass);
     $decoratedTaxonomyFactoryDefinition->setArguments([$translatableFactoryDefinition, new Reference('sylius.factory.taxon')]);
     $container->setDefinition('sylius.factory.taxonomy', $decoratedTaxonomyFactoryDefinition);
     $taxonFactoryDefinition = $container->getDefinition('sylius.factory.taxon');
     $taxonFactoryClass = $taxonFactoryDefinition->getClass();
     $taxonFactoryDefinition->setClass(TranslatableFactory::class);
     $decoratedTaxonFactoryDefinition = new Definition($taxonFactoryClass);
     $decoratedTaxonFactoryDefinition->addArgument($taxonFactoryDefinition)->addArgument(new Reference('sylius.repository.taxonomy'));
     $container->setDefinition('sylius.factory.taxon', $decoratedTaxonFactoryDefinition);
 }
 /**
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configs = $this->fixTemplatesConfiguration($configs, $container);
     $configuration = new Configuration();
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('doctrine_orm.xml');
     $loader->load('doctrine_orm_filter_types.xml');
     // TODO: Go back on xml configuration when bumping requirements to SF 2.6+
     $doctrineEMDefinition = $container->getDefinition('sonata.admin.entity_manager');
     if (method_exists($doctrineEMDefinition, 'setFactory')) {
         $doctrineEMDefinition->setFactory(array(new Reference('doctrine'), 'getEntityManager'));
     } else {
         $doctrineEMDefinition->setFactoryService('doctrine');
         $doctrineEMDefinition->setFactoryMethod('getEntityManager');
     }
     $bundles = $container->getParameter('kernel.bundles');
     if (isset($bundles['SimpleThingsEntityAuditBundle'])) {
         $loader->load('audit.xml');
         $container->setParameter('sonata_doctrine_orm_admin.audit.force', $config['audit']['force']);
     }
     $loader->load('security.xml');
     $container->setParameter('sonata_doctrine_orm_admin.entity_manager', $config['entity_manager']);
     $container->setParameter('sonata_doctrine_orm_admin.templates', $config['templates']);
     // define the templates
     $container->getDefinition('sonata.admin.builder.orm_list')->replaceArgument(1, $config['templates']['types']['list']);
     $container->getDefinition('sonata.admin.builder.orm_show')->replaceArgument(1, $config['templates']['types']['show']);
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $annotationsToLoad = array();
     if ($config['router']['annotations']) {
         $annotationsToLoad[] = 'routing.xml';
         $this->addClassesToCompile(array('Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ControllerListener'));
     }
     if ($config['request']['converters']) {
         $annotationsToLoad[] = 'converters.xml';
         $this->addClassesToCompile(array('Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ParamConverterListener', 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\DateTimeParamConverter', 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\DoctrineParamConverter', 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterInterface', 'Sensio\\Bundle\\FrameworkExtraBundle\\Request\\ParamConverter\\ParamConverterManager'));
     }
     if ($config['view']['annotations']) {
         $annotationsToLoad[] = 'view.xml';
         $this->addClassesToCompile(array('Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\TemplateListener'));
     }
     if ($config['cache']['annotations']) {
         $annotationsToLoad[] = 'cache.xml';
         $this->addClassesToCompile(array('Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\CacheListener'));
     }
     if ($annotationsToLoad) {
         // must be first
         $loader->load('annotations.xml');
         foreach ($annotationsToLoad as $config) {
             $loader->load($config);
         }
         $this->addClassesToCompile(array('Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\ConfigurationAnnotation'));
     }
 }
Ejemplo n.º 13
0
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $mainConfig = $this->getConfiguration($configs, $container);

        $config = $this->processConfiguration($mainConfig, $configs);

        // load services
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('payum.xml');
        $loader->load('security.xml');
        $loader->load('form.xml');

        if ($container->getParameter('kernel.debug')) {
            $loader->load('debug.xml');
        }

        $this->loadStorages($config['storages'], $container);
        $this->loadSecurity($config['security'], $container);

        $this->loadPayments($config['payments'], $container);

        if (isset($config['dynamic_payments'])) {
            $this->loadDynamicPayments($config['dynamic_payments'], $container);
        };
    }
Ejemplo n.º 14
0
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $container->setParameter("fom_user.selfregister", $config["selfregister"]);
     $container->setParameter("fom_user.reset_password", $config["reset_password"]);
     $container->setParameter("fom_user.max_registration_time", intval($config["max_registration_time"]));
     $container->setParameter("fom_user.max_reset_time", intval($config["max_reset_time"]));
     $container->setParameter("fom_user.mail_from_name", $config["mail_from_name"]);
     $container->setParameter("fom_user.mail_from_address", $config["mail_from_address"]);
     $container->setParameter("fom_user.profile_entity", $config["profile_entity"]);
     $container->setParameter("fom_user.profile_formtype", $config["profile_formtype"]);
     $container->setParameter("fom_user.profile_template", $config["profile_template"]);
     $container->setParameter("fom_user.profile_assets", $config["profile_assets"]);
     $container->setParameter("fom_user.self_registration_groups", $config["self_registration_groups"]);
     $container->setParameter("fom_user.user_own_permissions", $config["user_own_permissions"]);
     $container->setParameter('fom_user.use_sspi', $config['use_sspi']);
     $container->setParameter('fom_user.trust_sspi', $config['trust_sspi']);
     $container->setParameter("fom_user.auto_create_log_table", $config["auto_create_log_table"]);
     $container->setParameter("fom_user.login_check_log_time", $config["login_check_log_time"]);
     $container->setParameter("fom_user.login_attempts_before_delay", $config["login_attempts_before_delay"]);
     $container->setParameter("fom_user.login_delay_after_fail", $config["login_delay_after_fail"]);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('security.xml');
     $loader->load('services.xml');
 }
Ejemplo n.º 15
0
 /**
  * Loads the url shortener configuration.
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('cache.xml');
     $loader->load('counter.xml');
     $useOrm = 'auto' == $config['cache_invalidation']['orm_listener'] ? class_exists('Doctrine\\ORM\\Version') : $config['cache_invalidation']['orm_listener'];
     if ($useOrm) {
         $loader->load('orm.xml');
     }
     $usePhpcrOdm = 'auto' == $config['cache_invalidation']['phpcr_odm_listener'] ? class_exists('Doctrine\\PHPCR\\ODM\\Version') : $config['cache_invalidation']['phpcr_odm_listener'];
     if ($usePhpcrOdm) {
         $loader->load('phpcr_odm.xml');
     }
     $this->configureInvalidation($container, $config);
     if ($useOrm) {
         $this->configureORM($container, $config);
     }
     if ($usePhpcrOdm) {
         $this->configurePHPCRODM($container, $config);
     }
     $this->configureCache($container, $config);
     $this->configureCounter($container, $config);
 }
Ejemplo n.º 16
0
 /**
  * Loads the url shortener configuration.
  *
  * @param array            $configs   An array of configuration settings
  * @param ContainerBuilder $container A ContainerBuilder instance
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('block.xml');
     $loader->load('form.xml');
     $loader->load('core.xml');
     $loader->load('exception.xml');
     $this->configureContext($container, $config);
     $this->configureLoaderChain($container, $config);
     $this->configureCache($container, $config);
     $this->configureForm($container, $config);
     $this->configureProfiler($container, $config);
     $this->configureException($container, $config);
     $this->configureMenus($container, $config);
     $this->configureClassesToCompile();
     $bundles = $container->getParameter('kernel.bundles');
     if ($config['templates']['block_base'] === null) {
         if (isset($bundles['SonataPageBundle'])) {
             $config['templates']['block_base'] = 'SonataPageBundle:Block:block_base.html.twig';
             $config['templates']['block_container'] = 'SonataPageBundle:Block:block_container.html.twig';
         } else {
             $config['templates']['block_base'] = 'SonataBlockBundle:Block:block_base.html.twig';
             $config['templates']['block_container'] = 'SonataBlockBundle:Block:block_container.html.twig';
         }
     }
     $container->getDefinition('sonata.block.twig.global')->replaceArgument(0, $config['templates']);
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('auto_route.xml');
     $loader->load('token_providers.xml');
     $loader->load('defunct_route_handlers.xml');
     $loader->load('conflict_resolvers.xml');
     $config = $processor->processConfiguration($configuration, $configs);
     $resources = array();
     // auto mapping
     if ($config['auto_mapping']) {
         $bundles = $container->getParameter('kernel.bundles');
         $resources = $this->findMappingFiles($bundles);
     }
     // add configured mapping file resources
     if (isset($config['mapping']['resources'])) {
         foreach ($config['mapping']['resources'] as $resource) {
             $resources[] = $resource;
         }
     }
     $container->setParameter('cmf_routing_auto.metadata.loader.resources', $resources);
     $hasProvider = false;
     if ($this->isConfigEnabled($container, $config['persistence']['phpcr'])) {
         $hasProvider = true;
         $loader->load('phpcr-odm.xml');
         $container->setParameter('cmf_routing_auto.persistence.phpcr.route_basepath', $config['persistence']['phpcr']['route_basepath']);
     }
     if (!$hasProvider) {
         throw new InvalidConfigurationException('The RoutingAUtoBundle requires that you enable one of the persistence layers in your application configuration. ' . 'See the documentation for more information');
     }
 }
Ejemplo n.º 18
0
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $container->setParameter('nelmio_api_doc.motd.template', $config['motd']['template']);
     $container->setParameter('nelmio_api_doc.exclude_sections', $config['exclude_sections']);
     $container->setParameter('nelmio_api_doc.api_name', $config['name']);
     $container->setParameter('nelmio_api_doc.sandbox.enabled', $config['sandbox']['enabled']);
     $container->setParameter('nelmio_api_doc.sandbox.endpoint', $config['sandbox']['endpoint']);
     $container->setParameter('nelmio_api_doc.sandbox.accept_type', $config['sandbox']['accept_type']);
     $container->setParameter('nelmio_api_doc.sandbox.body_format.formats', $config['sandbox']['body_format']['formats']);
     $container->setParameter('nelmio_api_doc.sandbox.body_format.default_format', $config['sandbox']['body_format']['default_format']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.method', $config['sandbox']['request_format']['method']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.default_format', $config['sandbox']['request_format']['default_format']);
     $container->setParameter('nelmio_api_doc.sandbox.request_format.formats', $config['sandbox']['request_format']['formats']);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('formatters.xml');
     $loader->load('services.xml');
     if ($config['request_listener']['enabled']) {
         $container->setParameter('nelmio_api_doc.request_listener.parameter', $config['request_listener']['parameter']);
         $loader->load('request_listener.xml');
     }
     if (isset($config['sandbox']['authentication'])) {
         $container->setParameter('nelmio_api_doc.sandbox.authentication', $config['sandbox']['authentication']);
     }
     // backwards compatibility for Symfony2.1 https://github.com/nelmio/NelmioApiDocBundle/issues/231
     if (!interface_exists('\\Symfony\\Component\\Validator\\MetadataFactoryInterface')) {
         $container->setParameter('nelmio_api_doc.parser.validation_parser.class', 'Nelmio\\ApiDocBundle\\Parser\\ValidationParserLegacy');
     }
 }
Ejemplo n.º 19
0
 /**
  * Loads a specific configuration.
  *
  * @param array            $config    An array of configuration values
  * @param ContainerBuilder $container A ContainerBuilder instance
  *
  * @throws \InvalidArgumentException When provided tag is not defined in this extension
  *
  * @api
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('event_listeners.xml');
     $loader->load('serializer.xml');
     $loader->load('api_controllers.xml');
 }
 /**
  * {@inheritdoc}
  *
  * @throws InvalidConfigurationException
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     foreach ($config as $key => $value) {
         $container->setParameter($this->getAlias() . '.' . $key, $value);
     }
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     // Deprecated factory methods handling.
     // To be removed and set directly on config file when bumping Symfony requirements to >=2.6
     $aliceFakerDefinition = $container->getDefinition('hautelook_alice.faker');
     if (method_exists($aliceFakerDefinition, 'setFactory')) {
         $aliceFakerDefinition->setFactory(['Faker\\Factory', 'create']);
     } else {
         $aliceFakerDefinition->setFactoryClass('Faker\\Factory');
         $aliceFakerDefinition->setFactoryMethod('create');
     }
     foreach ($config['db_drivers'] as $driver => $isEnabled) {
         if (true === $isEnabled || null === $isEnabled && true === $this->isExtensionEnabled($driver)) {
             $loader->load(sprintf('%s.xml', $driver));
             if ('orm' === $driver) {
                 $this->setCommandFactory($container->getDefinition('hautelook_alice.doctrine.command.deprecated_load_command'));
                 $this->setCommandFactory($container->getDefinition('hautelook_alice.doctrine.command.load_command'));
             } else {
                 $this->setCommandFactory($container->getDefinition(sprintf('hautelook_alice.doctrine.%s.command.load_command', $driver)));
             }
         }
     }
     $container->getDefinition('hautelook_alice.alice.fixtures.loader')->replaceArgument(3, $container->getParameterBag()->all());
 }
Ejemplo n.º 21
0
 /**
  * Load configuration.
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('controllers.xml');
     if (isset($config['serializer'])) {
         $container->setAlias('fos_js_routing.serializer', new Alias($config['serializer'], false));
     } else {
         $loader->load('serializer.xml');
     }
     $container->setAlias('fos_js_routing.router', new Alias($config['router'], false));
     $container->getDefinition('fos_js_routing.extractor')->replaceArgument(1, $config['routes_to_expose']);
     if (isset($config['request_context_base_url'])) {
         $container->setParameter('fos_js_routing.request_context_base_url', $config['request_context_base_url']);
     }
     if (isset($config['cache_control'])) {
         $config['cache_control']['enabled'] = true;
     } else {
         $config['cache_control'] = array('enabled' => false);
     }
     $container->setParameter('fos_js_routing.cache_control', $config['cache_control']);
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('mobile_detect.xml');
     $loader->load('listener.xml');
     $loader->load('twig.xml');
     // valid mobile host
     if ($config['redirect']['mobile']['is_enabled'] && !$this->validHost($config['redirect']['mobile']['host'])) {
         $config['redirect']['mobile']['is_enabled'] = false;
     }
     // valid tablet host
     if ($config['redirect']['tablet']['is_enabled'] && !$this->validHost($config['redirect']['tablet']['host'])) {
         $config['redirect']['tablet']['is_enabled'] = false;
     }
     foreach ($config['redirect'] as $view => $viewConfig) {
         if (!empty($viewConfig['host_scheme']) && !empty($viewConfig['host'])) {
             $hostFullName = sprintf('%s://%s%s', $viewConfig['host_scheme'], $viewConfig['host'], $viewConfig['host_port'] == 80 ? '' : ':' . $viewConfig['host_port']);
             $config['redirect'][$view]['host'] = $hostFullName;
         }
         unset($config['redirect'][$view]['host_scheme'], $config['redirect'][$view]['host_port']);
     }
     $container->setParameter('mobile_detect.redirect', $config['redirect']);
     $container->setParameter('mobile_detect.switch_device_view.save_referer_path', $config['switch_device_view']['save_referer_path']);
     $container->setParameter('mobile_detect.mobile_detector.class', $config['mobile_detector_class']);
     $container->setParameter('mobile_detect.device_view.class', $config['device_view_class']);
     $container->setParameter('mobile_detect.request_listener.class', $config['request_listener_class']);
     $container->setParameter('mobile_detect.twig.extension.class', $config['extension_class']);
     $container->setAlias('mobile_detect.mobile_detector', $config['service']['mobile_detector']);
 }
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     // load db_driver container configuration
     $loader->load(sprintf('%s.xml', $config['db_driver']));
     if ($config['filter']['enabled']) {
         // if enabled - define filter
         $loader->load('filter.xml');
         $mailers = $config['filter']['mailer_name'];
         $filter = $container->getDefinition('shivas_bouncer.swift_mailer.filter');
         foreach ($mailers as $mailer) {
             $filter->addTag(sprintf('swiftmailer.%s.plugin', $mailer));
         }
     }
     $container->setParameter(sprintf('shivas_bouncer.backend_%s', $config['db_driver']), true);
     $container->setParameter('shivas_bouncer.driver', $config['db_driver']);
     $container->setParameter('shivas_bouncer.manager_name', $config['model_manager_name']);
     $container->setParameter('shivas_bouncer.bounce_endpoint', $config['bounce_endpoint']);
     $container->setParameter('shivas_bouncer.filter', $config['filter']);
     $container->setParameter('shivas_bouncer.filter.filter_not_permanent', $config['filter']['filter_not_permanent']);
     $container->setParameter('shivas_bouncer.aws_api_key', $config['aws_api_key']);
 }
 /**
  * Responds to the "white_october_admin" configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('admin.xml');
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // data managers
     if (!empty($config['data_managers']['mandango'])) {
         $loader->load('data_manager_mandango.xml');
     }
     if (!empty($config['data_managers']['doctrine']['orm'])) {
         $loader->load('data_manager_doctrine_orm.xml');
     }
     if (!empty($config['data_managers']['doctrine']['odm'])) {
         $loader->load('data_manager_doctrine_odm.xml');
     }
     // admins
     $adminIds = array();
     foreach ($config['admins'] as $admin) {
         $definition = new Definition($admin['class']);
         $definition->addMethodCall('setContainer', array(new Reference('service_container')));
         $classId = str_replace('\\', '_', $admin['class']);
         $adminId = 'white_october_admin.admin.' . $classId;
         $container->setDefinition($adminId, $definition);
         $adminIds[] = $adminId;
     }
     $container->getDefinition('white_october_admin.admin_factory')->replaceArgument(0, $adminIds);
 }
Ejemplo n.º 25
0
 /**
  * Responds to the twig configuration parameter.
  *
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('twig.xml');
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $container->setParameter('twig.exception_listener.controller', $config['exception_controller']);
     $container->setParameter('twig.form.resources', $config['form']['resources']);
     $reflClass = new \ReflectionClass('Symfony\\Bridge\\Twig\\Extension\\FormExtension');
     $container->getDefinition('twig.loader')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())) . '/Resources/views/Form'));
     if (!empty($config['globals'])) {
         $def = $container->getDefinition('twig');
         foreach ($config['globals'] as $key => $global) {
             if (isset($global['type']) && 'service' === $global['type']) {
                 $def->addMethodCall('addGlobal', array($key, new Reference($global['id'])));
             } else {
                 $def->addMethodCall('addGlobal', array($key, $global['value']));
             }
         }
     }
     unset($config['form'], $config['globals'], $config['extensions']);
     $container->setParameter('twig.options', $config);
     if ($container->getParameter('kernel.debug')) {
         $loader->load('debug.xml');
         $container->setDefinition('templating.engine.twig', $container->findDefinition('debug.templating.engine.twig'));
         $container->setAlias('debug.templating.engine.twig', 'templating.engine.twig');
     }
     $this->addClassesToCompile(array('Twig_Environment', 'Twig_ExtensionInterface', 'Twig_Extension', 'Twig_Extension_Core', 'Twig_Extension_Escaper', 'Twig_Extension_Optimizer', 'Twig_LoaderInterface', 'Twig_Markup', 'Twig_TemplateInterface', 'Twig_Template'));
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $this->config = $this->processConfiguration($configuration, $configs);
     $this->container = $container;
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('uploader.xml');
     $loader->load('templating.xml');
     $loader->load('validators.xml');
     $loader->load('errorhandler.xml');
     if ($this->config['twig']) {
         $loader->load('twig.xml');
     }
     $this->createChunkStorageService();
     $this->processOrphanageConfig();
     $container->setParameter('oneup_uploader.chunks', $this->config['chunks']);
     $container->setParameter('oneup_uploader.orphanage', $this->config['orphanage']);
     $controllers = array();
     $maxsize = array();
     // handle mappings
     foreach ($this->config['mappings'] as $key => $mapping) {
         $controllers[$key] = $this->processMapping($key, $mapping);
         $maxsize[$key] = $this->getMaxUploadSize($mapping['max_size']);
         $container->setParameter(sprintf('oneup_uploader.config.%s', $key), $mapping);
     }
     $container->setParameter('oneup_uploader.config', $this->config);
     $container->setParameter('oneup_uploader.controllers', $controllers);
     $container->setParameter('oneup_uploader.maxsize', $maxsize);
 }
Ejemplo n.º 27
0
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('plugins.xml');
     // Register default services
     foreach ($config['classes'] as $service => $class) {
         if (!empty($class)) {
             $container->register(sprintf('httplug.%s.default', $service), $class);
         }
     }
     // Set main aliases
     foreach ($config['main_alias'] as $type => $id) {
         $container->setAlias(sprintf('httplug.%s', $type), $id);
     }
     // Configure toolbar
     if ($this->isConfigEnabled($container, $config['profiling'])) {
         $loader->load('data-collector.xml');
         if (!empty($config['profiling']['formatter'])) {
             // Add custom formatter
             $container->getDefinition('httplug.collector.debug_collector')->replaceArgument(0, new Reference($config['profiling']['formatter']));
         }
         $container->getDefinition('httplug.formatter.full_http_message')->addArgument($config['profiling']['captured_body_length']);
     }
     $this->configureClients($container, $config);
     $this->configureSharedPlugins($container, $config['plugins']);
     // must be after clients, as clients.X.plugins might use plugins as templates that will be removed
     $this->configureAutoDiscoveryClients($container, $config);
 }
Ejemplo n.º 28
0
 /**
  * @see Symfony\Component\DependencyInjection\Extension.ExtensionInterface::load()
  * @param array                                                   $configs
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $configs);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('bbcode.xml');
     $loader->load('filters.xml');
     $loader->load('hooks.xml');
     $hooksConfig = isset($config['config']['hooks']) ? $config['config']['hooks'] : array();
     $hooks = array();
     foreach ($hooksConfig as $hook) {
         $hooks[$hook['classname']] = $hook['class'];
     }
     $filtersConfig = isset($config['config']['filters']) ? $config['config']['filters'] : array();
     $filters = array();
     foreach ($filtersConfig as $filter) {
         $filters[$filter['classname']] = $filter['class'];
     }
     $container->setParameter('fm_bbcode.filter_sets', $config['filter_sets']);
     $container->setParameter('fm_bbcode.config.filters', $filters);
     $container->setParameter('fm_bbcode.config.hooks', $hooks);
     $container->setParameter('fm_bbcode.config.messages', isset($config['config']['messages']) ? $config['config']['messages'] : null);
     $container->setParameter('fm_bbcode.config.templates', isset($config['config']['templates']) ? $config['config']['templates'] : array());
     if (isset($config['emoticon'])) {
         $this->registerEmoticonConfiguration($config['emoticon'], $container, $loader);
     }
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('form_flow.xml');
     $loader->load('twig.xml');
     $loader->load('util.xml');
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
     $loader->load('services_admin.xml');
     if ($config['rest']['search_activities'] == true) {
         $loader->load('services_search_activities_rest.xml');
     }
     $container->setParameter('mailgun.key', $config['key']);
     $container->setParameter('mailgun.domain', $config['domain']);
     $container->setParameter('redking_mail.default_from', $config['default_from']);
     $container->setParameter('redking_mail.auto_record_emails', $config['auto_record_emails']);
     $definitionDecorator = new DefinitionDecorator('swiftmailer.transport.eventdispatcher.abstract');
     $container->setDefinition('mailgun.swift_transport.eventdispatcher', $definitionDecorator);
     $container->getDefinition('mailgun.swift_transport.transport')->replaceArgument(0, new Reference('mailgun.swift_transport.eventdispatcher'));
     //set some alias
     $container->setAlias('mailgun', 'mailgun.swift_transport.transport');
     $container->setAlias('swiftmailer.mailer.transport.mailgun', 'mailgun.swift_transport.transport');
     $container->setAlias('swiftmailer.mailer.default.transport', 'swiftmailer.mailer.transport.mailgun');
     $delivery_enabled = true;
     try {
         $delivery_enabled = $container->getParameter('swiftmailer.mailer.default.delivery.enabled');
     } catch (InvalidArgumentException $e) {
     }
     $container->setParameter('redking_mail.delivery_enabled', $delivery_enabled);
 }