当前位置: 首页>>代码示例>>PHP>>正文


PHP ContainerBuilder::hasParameter方法代码示例

本文整理汇总了PHP中Symfony\Component\DependencyInjection\ContainerBuilder::hasParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::hasParameter方法的具体用法?PHP ContainerBuilder::hasParameter怎么用?PHP ContainerBuilder::hasParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\DependencyInjection\ContainerBuilder的用法示例。


在下文中一共展示了ContainerBuilder::hasParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $fileSystem = new Filesystem();
     $container->setParameter('symfonian_id.gammu.smsd_inject_path', $config['smsd_inject_path']);
     $container->setParameter('symfonian_id.gammu.gammu_path', $config['gammu_path']);
     foreach ($config['gammurc_path'] as $key => $gammurc) {
         if ($fileSystem->exists($gammurc['path'])) {
             throw new FileNotFoundException(sprintf('%s not found.'));
         }
         if (!$container->hasParameter('symfonian_id.gammu.gammurc.default')) {
             $container->setParameter('symfonian_id.gammu.gammurc.default', $gammurc['path']);
         }
         $container->setParameter('symfonian_id.gammu.gammurc.' . $key, $gammurc['path']);
     }
     foreach ($config['smsdrc_path'] as $key => $smsdrc) {
         if (!$fileSystem->exists($smsdrc['path'])) {
             throw new FileNotFoundException(sprintf('%s not found.', $smsdrc['path']));
         }
         if (!$container->hasParameter('symfonian_id.gammu.smsdrc.default')) {
             $container->setParameter('symfonian_id.gammu.smsdrc.default', $smsdrc['path']);
         }
         $container->setParameter('symfonian_id.gammu.smsdrc.' . $key, $smsdrc['path']);
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
开发者ID:TiiToo,项目名称:GammuBundle,代码行数:28,代码来源:SymfonianIndonesiaGammuExtension.php

示例2: load

 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->processConfiguration($configuration, $configs);
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services/manipulator.yml');
     $container->setParameter('avro_generator.style', $config['style']);
     $container->setParameter('avro_generator.overwrite', $config['overwrite']);
     $container->setParameter('avro_generator.add_fields', $config['add_fields']);
     $container->setParameter('avro_generator.use_owner', $config['use_owner']);
     $loader->load(sprintf('templates/%s.yml', $config['style']));
     if ($container->hasParameter('avro_generator.files')) {
         $container->setParameter('avro_generator.files', array_merge($container->getParameter('avro_generator.files'), $config['files']));
     } else {
         $container->setParameter('avro_generator.files', $config['files']);
     }
     if ($container->hasParameter('avro_generator.standalone_files')) {
         $container->setParameter('avro_generator.standalone_files', array_merge($container->getParameter('avro_generator.standalone_files'), $config['standalone_files']));
     } else {
         $container->setParameter('avro_generator.standalone_files', $config['standalone_files']);
     }
     if ($container->hasParameter('avro_generator.bundle_folders')) {
         $container->setParameter('avro_generator.bundle_folders', array_merge($container->getParameter('avro_generator.bundle_folders'), $config['bundle_folders']));
     } else {
         $container->setParameter('avro_generator.bundle_folders', $config['bundle_folders']);
     }
     if ($container->hasParameter('avro_generator.bundle_files')) {
         $container->setParameter('avro_generator.bundle_files', array_merge($container->getParameter('avro_generator.bundle_files'), $config['bundle_files']));
     } else {
         $container->setParameter('avro_generator.bundle_files', $config['bundle_files']);
     }
 }
开发者ID:newism,项目名称:GeneratorBundle,代码行数:33,代码来源:AvroGeneratorExtension.php

示例3: array

 function it_processes_the_configuration_and_registers_services_per_subject(ContainerBuilder $container)
 {
     $container->hasParameter('sylius.translation.mapping')->willReturn(false);
     $container->hasParameter('sylius.translation.default.mapping')->willReturn(true);
     $container->getParameter('sylius.translation.default.mapping')->willReturn(array(array('default_mapping' => array('translatable' => array('field' => 'translations', 'currentLocale' => 'currentLocale', 'fallbackLocale' => 'fallbackLocale'), 'translation' => array('field' => 'translatable', 'locale' => 'locale')))));
     $attributeFormType = new Definition('Some\\App\\Product\\Form\\AttributeType');
     $attributeFormType->setArguments(array('Some\\App\\Product\\Entity\\Attribute', '%sylius.validation_group.product_attribute%', 'product'));
     $attributeFormType->addTag('form.type', array('alias' => 'sylius_product_attribute'));
     $container->setDefinition('sylius.form.type.product_attribute', $attributeFormType)->shouldBeCalled();
     $attributeTranslationFormType = new Definition('Some\\App\\Product\\Form\\AttributeTranslationType');
     $attributeTranslationFormType->setArguments(array('Some\\App\\Product\\Entity\\AttributeTranslation', '%sylius.validation_group.product_attribute_translation%', 'product'));
     $attributeTranslationFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_translation'));
     $container->setDefinition('sylius.form.type.product_attribute_translation', $attributeTranslationFormType)->shouldBeCalled();
     $choiceTypeClasses = array(SyliusResourceBundle::DRIVER_DOCTRINE_ORM => 'Sylius\\Bundle\\AttributeBundle\\Form\\Type\\AttributeEntityChoiceType');
     $attributeChoiceFormType = new Definition($choiceTypeClasses[SyliusResourceBundle::DRIVER_DOCTRINE_ORM]);
     $attributeChoiceFormType->setArguments(array('product', 'Some\\App\\Product\\Entity\\Attribute'));
     $attributeChoiceFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_choice'));
     $container->setDefinition('sylius.form.type.product_attribute_choice', $attributeChoiceFormType)->shouldBeCalled();
     $attributeValueFormType = new Definition('Some\\App\\Product\\Form\\AttributeValueType');
     $attributeValueFormType->setArguments(array('Some\\App\\Product\\Entity\\AttributeValue', '%sylius.validation_group.product_attribute_value%', 'product'));
     $attributeValueFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_value'));
     $container->setDefinition('sylius.form.type.product_attribute_value', $attributeValueFormType)->shouldBeCalled();
     $subjects = array('product' => array('subject' => 'Some\\App\\Product\\Entity\\Product', 'attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType')));
     $container->setParameter('sylius.attribute.subjects', $subjects)->shouldBeCalled();
     $userConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product' => array('subject' => 'Some\\App\\Product\\Entity\\Product', 'attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType'))));
     $processedConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product_attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'product_attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType')), 'validation_groups' => array('product_attribute' => array('sylius'), 'product_attribute_translation' => array('sylius'), 'product_attribute_value' => array('sylius')));
     $this->process($userConfig, $container)->shouldReturn($processedConfig);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:28,代码来源:SyliusAttributeExtensionSpec.php

示例4: process

 /**
  * {@inheritDoc}
  * Set fixed templates
  * @see \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()
  */
 public function process(ContainerBuilder $container)
 {
     $bundles = $container->getParameter('kernel.bundles');
     if (isset($bundles['CmfBlockBundle'])) {
         $prefix = $container->getParameter('nvbooster_starter.block.attribute.prefix');
         $blockLoader = $container->getDefinition('cmf.block.container');
         $blockLoader->setClass('nvbooster\\StarterBundle\\Block\\ContainerBlockService');
         $blockLoader->addMethodCall('setAttributesPrefix', array($prefix));
         if ($container->hasParameter('nvbooster_starter.template.containerblock') && ($template = $container->getParameter('nvbooster_starter.template.containerblock'))) {
             $blockLoader->replaceArgument(3, $template);
         }
         $blockLoader = $container->getDefinition('cmf.block.slideshow');
         if ($container->hasParameter('nvbooster_starter.template.slideshowblock') && ($template = $container->getParameter('nvbooster_starter.template.slideshowblock'))) {
             $blockLoader->replaceArgument(3, $template);
         }
         $blockLoader = $container->getDefinition('cmf.block.string');
         $blockLoader->setClass('nvbooster\\StarterBundle\\Block\\StringBlockService');
         $blockLoader->addMethodCall('setAttributesPrefix', array($prefix));
         $blockLoader = $container->getDefinition('cmf.block.simple');
         $blockLoader->setClass('nvbooster\\StarterBundle\\Block\\SimpleBlockService');
         $blockLoader->addMethodCall('setAttributesPrefix', array($prefix));
         $blockLoader = $container->getDefinition('cmf.block.action');
         $blockLoader->setClass('nvbooster\\StarterBundle\\Block\\ActionBlockService');
         $blockLoader->addMethodCall('setAttributesPrefix', array($prefix));
         if ($container->hasDefinition('cmf.block.imagine')) {
             $blockLoader = $container->getDefinition('cmf.block.imagine');
             $blockLoader->setClass('nvbooster\\StarterBundle\\Block\\StringBlockService');
             $blockLoader->addMethodCall('setAttributesPrefix', array($prefix));
         }
     }
     if ($def = $container->getDefinition('cmf_seo.presentation')) {
         $def->replaceArgument(3, null);
     }
 }
开发者ID:nvbooster,项目名称:StarterBundle,代码行数:39,代码来源:CompilerPass.php

示例5: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasParameter('fos_user.storage')) {
         return;
     }
     $storage = $container->getParameter('fos_user.storage');
     if ('custom' === $storage) {
         return;
     }
     $validationFile = __DIR__ . '/../../Resources/config/validation/' . $storage . '.xml';
     if ($container->hasDefinition('validator.builder')) {
         // Symfony 2.5+
         $container->getDefinition('validator.builder')->addMethodCall('addXmlMapping', array($validationFile));
         return;
     }
     // Old method of loading validation
     if (!$container->hasParameter('validator.mapping.loader.xml_files_loader.mapping_files')) {
         return;
     }
     $files = $container->getParameter('validator.mapping.loader.xml_files_loader.mapping_files');
     if (is_file($validationFile)) {
         $files[] = realpath($validationFile);
         $container->addResource(new FileResource($validationFile));
     }
     $container->setParameter('validator.mapping.loader.xml_files_loader.mapping_files', $files);
 }
开发者ID:jjspider277,项目名称:weddings,代码行数:29,代码来源:ValidationPass.php

示例6: process

 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     $formType = 'fos_user.registration.form.type';
     if ($container->hasParameter($formType)) {
         $value = $container->getParameter($formType);
         if ($value == 'fos_user_registration') {
             $container->setParameter($formType, 'glory_user_register');
         }
     }
     $formName = 'fos_user.registration.form.name';
     if ($container->hasParameter($formName)) {
         $value = $container->getParameter($formName);
         if ($value == 'fos_user_registration_form') {
             $container->setParameter($formName, 'user');
         }
     }
     $formName = 'fos_user.registration.form.validation_groups';
     if ($container->hasParameter($formName)) {
         $groups = $container->getParameter($formName);
         if (in_array('Registration', $groups)) {
             $key = array_search('Registration', $groups);
             $groups[$key] = 'Register';
             $container->setParameter($formName, $groups);
         }
     }
 }
开发者ID:foreverglory,项目名称:user-bundle,代码行数:29,代码来源:RegisterPass.php

示例7: configuration

 /**
  * Tests the rest client configuration
  *
  * @test
  *
  * @covers Ci\RestClientBundle\DependencyInjection\CiRestClientExtension::load
  * @covers Ci\RestClientBundle\DependencyInjection\Configuration::getConfigTreeBuilder
  */
 public function configuration()
 {
     $preConfigs = array('ci_rest_client' => array('curl' => array('defaults' => array('CURLOPT_MAXREDIRS' => 30))));
     $this->loadConfiguration($this->container, $preConfigs);
     $this->container->compile();
     $this->assertTrue($this->container->hasParameter('ci.restclient.curl.defaults'));
     $this->assertSame($preConfigs['ci_rest_client']['curl']['defaults']['CURLOPT_MAXREDIRS'], $this->container->getParameter('ci.restclient.curl.defaults')[CURLOPT_MAXREDIRS]);
 }
开发者ID:korbav,项目名称:CiRestClientBundle,代码行数:16,代码来源:ServiceDefinitionTest.php

示例8: testEmptyConfigUsesDefaultValuesAndServicesAreCreated

 public function testEmptyConfigUsesDefaultValuesAndServicesAreCreated()
 {
     $this->container->setParameter('excepciones', array('email_admin_contact' => 'dacasals@uci.cu'));
     $this->extension->load(array(), $this->container);
     $this->assertTrue($this->container->hasParameter('excp_excepciones_bundle'));
     $this->assertTrue(array_key_exists('excepciones', $this->container->getParameter('excp_excepciones_bundle')));
     $this->assertTrue($this->container->has('kernel.excepciones.listener'));
 }
开发者ID:bosonsymfony,项目名称:excepciones-bundle,代码行数:8,代码来源:ExcepcionesExtensionTest.php

示例9: testLoadSetsTheClientClassParameter

 /**
  * @dataProvider getValidClients
  */
 public function testLoadSetsTheClientClassParameter($client)
 {
     if (in_array(strtolower($client), array('curl', 'multi_curl')) && !extension_loaded('curl')) {
         $this->setExpectedException('Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException');
     }
     $this->extension->load(array(array('client' => $client)), $this->container);
     $this->assertTrue($this->container->hasParameter('gremo_buzz.client.class'));
 }
开发者ID:javiervivanco,项目名称:GremoBuzzBundle,代码行数:11,代码来源:GremoBuzzExtensionTest.php

示例10: process

 /**
  * @param ContainerBuilder $container
  */
 public function process(ContainerBuilder $container)
 {
     if ($container->hasParameter('bigfoot_core.routing.replace_symfony_router') && true === $container->getParameter('bigfoot_core.routing.replace_symfony_router')) {
         if ($container->hasParameter('bigfoot_core.routing.routers_by_id')) {
             $container->setAlias('router.default', 'bigfoot_core.cmf_routing.router');
         }
     }
 }
开发者ID:7rin0,项目名称:BigfootCoreBundle,代码行数:11,代码来源:SetRouterPass.php

示例11: testTest

 /**
  * Test normal config
  */
 public function testTest()
 {
     $this->loadConfiguration($this->container, 'test');
     $this->container->compile();
     $this->assertTrue($this->container->hasParameter('robots_txt'));
     $robotsTxt = $this->container->getParameter('robots_txt');
     $this->assertNotEmpty($robotsTxt);
     $this->assertEquals($robotsTxt[0], 'User-agent: *');
 }
开发者ID:evheniy,项目名称:RobotsTxtBundle,代码行数:12,代码来源:RobotsTxtExtensionTest.php

示例12: testInitConfiguration

 public function testInitConfiguration()
 {
     $config = ['leezy_pheanstalk' => ['pheanstalks' => ['primary' => ['server' => 'beanstalkd.domain.tld', 'port' => 11300, 'timeout' => 60, 'default' => true]]]];
     $this->extension->load($config, $this->container);
     $this->container->compile();
     $this->assertTrue($this->container->hasDefinition('leezy.pheanstalk.pheanstalk_locator'));
     $this->assertTrue($this->container->hasParameter('leezy.pheanstalk.pheanstalks'));
     // Needed by ProxyCompilerPass
 }
开发者ID:michalmrzyk,项目名称:LeezyPheanstalkBundle,代码行数:9,代码来源:LeezyPheanstalkExtensionTest.php

示例13: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     if ($container->hasParameter($parameter = 'templating.helper.form.resources')) {
         $container->setParameter($parameter, array_merge(array('IvoryCKEditorBundle:Form'), $container->getParameter($parameter)));
     }
     if ($container->hasParameter($parameter = 'twig.form.resources')) {
         $container->setParameter($parameter, array_merge(array('IvoryCKEditorBundle:Form:ckeditor_widget.html.twig'), $container->getParameter($parameter)));
     }
 }
开发者ID:kazak,项目名称:forum,代码行数:12,代码来源:ResourceCompilerPass.php

示例14: process

 /**
  * {@inheritdoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$container->hasParameter('cmf_routing.dynamic.persistence.phpcr.route_basepaths') || !$container->hasParameter('cmf_simple_cms.persistence.phpcr.basepath')) {
         return;
     }
     $routeBasepaths = $container->getParameter('cmf_routing.dynamic.persistence.phpcr.route_basepaths');
     $routeBasepaths[] = $container->getParameter('cmf_simple_cms.persistence.phpcr.basepath');
     $container->setParameter('cmf_routing.dynamic.persistence.phpcr.route_basepaths', array_unique($routeBasepaths));
 }
开发者ID:creatiombe,项目名称:SimpleCmsBundle,代码行数:12,代码来源:AppendRouteBasepathPass.php

示例15: testLoadServices

 /**
  * @dataProvider loadServiceDataProvider
  */
 public function testLoadServices($service, $class, array $arguments, array $tags, $scope)
 {
     $this->extension->load(array(), $this->container);
     $definition = $this->container->getDefinition($service);
     $this->assertEquals($class, $definition->getClass());
     $this->assertTrue($this->container->hasParameter(trim($class, '%')));
     $this->assertEquals($arguments, $definition->getArguments());
     $this->assertEquals($tags, $definition->getTags());
     $this->assertEquals($scope, $definition->getScope());
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:OroEntityMergeExtensionTest.php


注:本文中的Symfony\Component\DependencyInjection\ContainerBuilder::hasParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。