本文整理汇总了PHP中Symfony\Component\DependencyInjection\Loader\XmlFileLoader::load方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlFileLoader::load方法的具体用法?PHP XmlFileLoader::load怎么用?PHP XmlFileLoader::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\Loader\XmlFileLoader
的用法示例。
在下文中一共展示了XmlFileLoader::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* {@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')]);
}
}
示例2: load
/**
* {@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');
}
示例3: load
/**
* {@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');
}
}
示例4: load
/**
* {@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');
}
示例5: load
/**
* {@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);
}
示例6: load
/**
* {@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')));
}
示例7: loadInternal
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');
}
示例8: load
/**
* 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);
}
示例9: load
/**
* 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);
}
示例10: load
/**
* {@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);
}
示例11: load
/**
* @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']);
}
示例12: load
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'));
}
}
示例13: load
/**
* {@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);
};
}
示例14: load
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');
}
示例15: load
/**
* 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);
}