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


PHP BuilderConfiguration::getParameter方法代码示例

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


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

示例1: testSetGetParameter

 public function testSetGetParameter()
 {
     $configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
     $configuration->setParameter('bar', 'foo');
     $this->assertEquals($configuration->getParameter('bar'), 'foo', '->setParameter() sets the value of a new parameter');
     $configuration->setParameter('foo', 'baz');
     $this->assertEquals($configuration->getParameter('foo'), 'baz', '->setParameter() overrides previously set parameter');
     $configuration->setParameter('Foo', 'baz1');
     $this->assertEquals($configuration->getParameter('foo'), 'baz1', '->setParameter() converts the key to lowercase');
     $this->assertEquals($configuration->getParameter('FOO'), 'baz1', '->getParameter() converts the key to lowercase');
     try {
         $configuration->getParameter('baba');
         $this->fail('->getParameter() throws an \\InvalidArgumentException if the key does not exist');
     } catch (\InvalidArgumentException $e) {
     }
 }
开发者ID:CodingFabian,项目名称:symfony,代码行数:16,代码来源:BuilderConfigurationTest.php

示例2: configLoad

 public function configLoad($config, BuilderConfiguration $configuration)
 {
     if (!$configuration->hasDefinition('twig')) {
         $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
         $configuration->merge($loader->load('twig.xml'));
     }
     $configuration->setParameter('twig.options', array_replace($configuration->getParameter('twig.options'), $config));
 }
开发者ID:klaasn,项目名称:symfony-sandbox,代码行数:8,代码来源:TwigExtension.php

示例3: configLoad

 public function configLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load('twig.xml'));
     $configuration->setParameter('twig_options', array_replace($configuration->getParameter('twig_options'), $config));
     return $configuration;
 }
开发者ID:poulikov,项目名称:symfony,代码行数:8,代码来源:TwigExtension.php

示例4: mailerLoad

 /**
  * Loads the Swift Mailer configuration.
  *
  * Usage example:
  *
  *      <swift:mailer transport="gmail" delivery_strategy="spool">
  *        <swift:username>fabien</swift:username>
  *        <swift:password>xxxxx</swift:password>
  *        <swift:spool path="/path/to/spool/" />
  *      </swift:mailer>
  *
  * @param array $config A configuration array
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function mailerLoad($config, BuilderConfiguration $configuration)
 {
     if (!$configuration->hasDefinition('swiftmailer.mailer')) {
         $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
         $configuration->merge($loader->load($this->resources['mailer']));
         $configuration->setAlias('mailer', 'swiftmailer.mailer');
     }
     $r = new \ReflectionClass('Swift_Message');
     $configuration->setParameter('swiftmailer.base_dir', dirname(dirname(dirname($r->getFilename()))));
     $transport = $configuration->getParameter('swiftmailer.transport.name');
     if (array_key_exists('transport', $config)) {
         if (null === $config['transport']) {
             $transport = 'null';
         } elseif ('gmail' === $config['transport']) {
             $config['encryption'] = 'ssl';
             $config['auth_mode'] = 'login';
             $config['host'] = 'smtp.gmail.com';
             $transport = 'smtp';
         } else {
             $transport = $config['transport'];
         }
         $configuration->setParameter('swiftmailer.transport.name', $transport);
     }
     $configuration->setAlias('swiftmailer.transport', 'swiftmailer.transport.' . $transport);
     if (isset($config['encryption']) && 'ssl' === $config['encryption'] && !isset($config['port'])) {
         $config['port'] = 465;
     }
     foreach (array('encryption', 'port', 'host', 'username', 'password', 'auth_mode') as $key) {
         if (isset($config[$key])) {
             $configuration->setParameter('swiftmailer.transport.' . $transport . '.' . $key, $config[$key]);
         }
     }
     // spool?
     if (isset($config['spool'])) {
         $type = isset($config['type']) ? $config['type'] : 'file';
         $configuration->setAlias('swiftmailer.transport.real', 'swiftmailer.transport.' . $transport);
         $configuration->setAlias('swiftmailer.transport', 'swiftmailer.transport.spool');
         $configuration->setAlias('swiftmailer.spool', 'swiftmailer.spool.' . $type);
         foreach (array('path') as $key) {
             if (isset($config['spool'][$key])) {
                 $configuration->setParameter('swiftmailer.spool.' . $type . '.' . $key, $config['spool'][$key]);
             }
         }
     }
     if (isset($config['delivery_address'])) {
         $configuration->setParameter('swiftmailer.single_address', $config['delivery_address']);
         $configuration->findDefinition('swiftmailer.transport')->addMethodCall('registerPlugin', array(new Reference('swiftmailer.plugin.redirecting')));
     }
     if (isset($config['disable_delivery']) && $config['disable_delivery']) {
         $configuration->findDefinition('swiftmailer.transport')->addMethodCall('registerPlugin', array(new Reference('swiftmailer.plugin.blackhole')));
     }
     return $configuration;
 }
开发者ID:pgodel,项目名称:PageRoller,代码行数:68,代码来源:SwiftmailerExtension.php

示例5: dbalLoad

 /**
  * Loads the DBAL configuration.
  *
  * @param array $config A configuration array
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function dbalLoad($config, BuilderConfiguration $configuration)
 {
     if (!$configuration->hasDefinition('propel')) {
         $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
         $configuration->merge($loader->load($this->resources['propel']));
     }
     $defaultConnection = array('driver' => 'mysql', 'user' => 'root', 'password' => null, 'dsn' => null, 'classname' => 'DebugPDO', 'options' => array(), 'attributes' => array(), 'settings' => array('charset' => array('value' => 'UTF8')));
     $defaultConnectionName = isset($config['default_connection']) ? $config['default_connection'] : $configuration->getParameter('propel.dbal.default_connection');
     $configuration->setParameter('propel.dbal.default_connection', $defaultConnectionName);
     $connections = array();
     if (isset($config['connections'])) {
         foreach ($config['connections'] as $name => $connection) {
             $connections[isset($connection['id']) ? $connection['id'] : $name] = $connection;
         }
     } else {
         $connections = array($defaultConnectionName => $config);
     }
     $arguments = $configuration->getDefinition('propel.configuration')->getArguments();
     if (count($arguments)) {
         $c = $arguments[0];
     } else {
         $c = array('log' => array('level' => 7), 'datasources' => array());
     }
     foreach ($connections as $name => $connection) {
         if (isset($c['datasources'][$name])) {
         } else {
             $connection = array_replace($defaultConnection, $connection);
             $c['datasources'][$name] = array('connection' => array());
         }
         if (isset($connection['driver'])) {
             $c['datasources'][$name]['adapter'] = $connection['driver'];
         }
         foreach (array('dsn', 'user', 'password', 'classname', 'options', 'attributes', 'settings') as $att) {
             if (isset($connection[$att])) {
                 $c['datasources'][$name]['connection'][$att] = $connection[$att];
             }
         }
     }
     $configuration->getDefinition('propel.configuration')->setArguments(array($c));
     return $configuration;
 }
开发者ID:bill97420,项目名称:symfony,代码行数:48,代码来源:PropelExtension.php

示例6: array

$configuration->setParameters(array('foo' => 'bar'));
$t->is($configuration->getParameters(), array('foo' => 'bar'), '->setParameters() sets the parameters');

$configuration->setParameters(array('bar' => 'foo'));
$t->is($configuration->getParameters(), array('bar' => 'foo'), '->setParameters() overrides the previous defined parameters');

$configuration->setParameters(array('Bar' => 'foo'));
$t->is($configuration->getParameters(), array('bar' => 'foo'), '->setParameters() converts the key to lowercase');

// ->setParameter() ->getParameter()
$t->diag('->setParameter() ->getParameter() ');

$configuration = new BuilderConfiguration(array(), array('foo' => 'bar'));
$configuration->setParameter('bar', 'foo');
$t->is($configuration->getParameter('bar'), 'foo', '->setParameter() sets the value of a new parameter');

$configuration->setParameter('foo', 'baz');
$t->is($configuration->getParameter('foo'), 'baz', '->setParameter() overrides previously set parameter');

$configuration->setParameter('Foo', 'baz1');
$t->is($configuration->getParameter('foo'), 'baz1', '->setParameter() converts the key to lowercase');
$t->is($configuration->getParameter('FOO'), 'baz1', '->getParameter() converts the key to lowercase');

try
{
  $configuration->getParameter('baba');
  $t->fail('->getParameter() throws an \InvalidArgumentException if the key does not exist');
}
catch (\InvalidArgumentException $e)
{
开发者ID:nicolasmartin,项目名称:symfony,代码行数:30,代码来源:BuilderConfigurationTest.php

示例7: ormLoad

 /**
  * Loads the Doctrine ORM configuration.
  *
  * @param array $config A configuration array
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function ormLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load($this->resources['orm']));
     $config['default_entity_manager'] = isset($config['default_entity_manager']) ? $config['default_entity_manager'] : 'default';
     foreach (array('metadata_driver', 'cache_driver') as $key) {
         if (isset($config[$key])) {
             $configuration->setParameter('doctrine.orm.' . $key, $config[$key]);
         }
     }
     $config['entity_managers'] = isset($config['entity_managers']) ? $config['entity_managers'] : array($config['default_entity_manager'] => array());
     foreach ($config['entity_managers'] as $name => $connection) {
         $ormConfigDef = new Definition('Doctrine\\ORM\\Configuration');
         $configuration->setDefinition(sprintf('doctrine.orm.%s_configuration', $name), $ormConfigDef);
         $drivers = array('metadata', 'query', 'result');
         foreach ($drivers as $driver) {
             $definition = $configuration->getDefinition(sprintf('doctrine.orm.cache.%s', $configuration->getParameter('doctrine.orm.cache_driver')));
             $clone = clone $definition;
             $clone->addMethodCall('setNamespace', array(sprintf('doctrine_%s_', $driver)));
             $configuration->setDefinition(sprintf('doctrine.orm.%s_cache', $driver), $clone);
         }
         // configure metadata driver for each bundle based on the type of mapping files found
         $mappingDriverDef = new Definition('Doctrine\\ORM\\Mapping\\Driver\\DriverChain');
         $bundleEntityMappings = array();
         $bundleDirs = $this->bundleDirs;
         $aliasMap = array();
         foreach (array_reverse($this->bundles) as $className) {
             $tmp = dirname(str_replace('\\', '/', $className));
             $namespace = str_replace('/', '\\', dirname($tmp));
             $class = basename($tmp);
             if (!isset($bundleDirs[$namespace])) {
                 continue;
             }
             $type = false;
             if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/Resources/config/doctrine/metadata')) {
                 $type = $this->detectMappingType($dir);
             }
             if (is_dir($dir = $bundleDirs[$namespace] . '/' . $class . '/Entities')) {
                 if ($type === false) {
                     $type = 'annotation';
                 }
                 $aliasMap[$class] = $namespace . '\\' . $class . '\\Entities';
             }
             if (false !== $type) {
                 $mappingDriverDef->addMethodCall('addDriver', array(new Reference(sprintf('doctrine.orm.metadata_driver.%s', $type)), $namespace . '\\' . $class . '\\Entities'));
             }
         }
         $ormConfigDef->addMethodCall('setEntityNamespaces', array($aliasMap));
         $configuration->setDefinition('doctrine.orm.metadata_driver', $mappingDriverDef);
         $methods = array('setMetadataCacheImpl' => new Reference('doctrine.orm.metadata_cache'), 'setQueryCacheImpl' => new Reference('doctrine.orm.query_cache'), 'setResultCacheImpl' => new Reference('doctrine.orm.result_cache'), 'setMetadataDriverImpl' => new Reference('doctrine.orm.metadata_driver'), 'setProxyDir' => '%kernel.cache_dir%/doctrine/Proxies', 'setProxyNamespace' => 'Proxies', 'setAutoGenerateProxyClasses' => true);
         foreach ($methods as $method => $arg) {
             $ormConfigDef->addMethodCall($method, array($arg));
         }
         $ormEmArgs = array(new Reference(sprintf('doctrine.dbal.%s_connection', isset($connection['connection']) ? $connection['connection'] : $name)), new Reference(sprintf('doctrine.orm.%s_configuration', $name)));
         $ormEmDef = new Definition('Doctrine\\ORM\\EntityManager', $ormEmArgs);
         $ormEmDef->setConstructor('create');
         $configuration->setDefinition(sprintf('doctrine.orm.%s_entity_manager', $name), $ormEmDef);
         if ($name == $config['default_entity_manager']) {
             $configuration->setAlias('doctrine.orm.entity_manager', sprintf('doctrine.orm.%s_entity_manager', $name));
         }
     }
     $configuration->setAlias('doctrine.orm.cache', sprintf('doctrine.orm.cache.%s', $configuration->getParameter('doctrine.orm.cache_driver')));
     return $configuration;
 }
开发者ID:poulikov,项目名称:symfony,代码行数:72,代码来源:DoctrineExtension.php

示例8: odmLoad

 public function odmLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load($this->_resources['odm']));
     $configuration->setParameter('doctrine.odm.mongo.default_database', $this->appName);
     $configuration->setParameter('doctrine.odm.mongo.proxy_dir', sprintf('%s/Proxies', $this->tmpDir));
     if (isset($config['cache_driver'])) {
         $configuration->setAlias('doctrine.odm.cache', sprintf('doctrine.odm.cache.%s', $config['cache_driver']));
     }
     $config['metadata_driver'] = isset($config['metadata_driver']) ? $config['metadata_driver'] : 'auto';
     if ('auto' == $config['metadata_driver']) {
         $configuration->setAlias('doctrine.odm.mongo.metadata_driver', 'doctrine.odm.mongo.metadata_driver.chain');
         $driverChainDef = $configuration->getDefinition('doctrine.odm.mongo.metadata_driver.chain');
         foreach (array_reverse($this->bundles) as $className) {
             $tmp = dirname(str_replace('\\', '/', $className));
             $namespace = str_replace('/', '\\', dirname($tmp));
             $class = basename($tmp);
             if (!isset($this->bundleDirs[$namespace])) {
                 continue;
             }
             $type = false;
             if (is_dir($dir = $this->bundleDirs[$namespace] . '/' . $class . '/Resources/config/doctrine/metadata')) {
                 $type = $this->detectMappingType($dir);
             }
             if (is_dir($dir = $this->bundleDirs[$namespace] . '/' . $class . '/Documents')) {
                 $type = 'annotation';
             }
             if (false !== $type) {
                 $driverChainDef->addMethodCall('addDriver', array(new Reference(sprintf('doctrine.odm.mongo.metadata_driver.%s', $type)), $namespace . '\\' . $class));
             }
         }
     } else {
         $configuration->setAlias('doctrine.odm.mongo.metadata_driver', sprintf('doctrine.odm.mongo.metadata_driver.%s', $config['metadata_driver']));
     }
     $config['default_document_manager'] = isset($config['default_document_manager']) ? $config['default_document_manager'] : 'default';
     $config['document_managers'] = isset($config['document_managers']) ? $config['document_managers'] : array($config['default_document_manager'] => array());
     $defaultManagerParams = array('connection' => 'default');
     $defaultConnectionParams = array('server' => sprintf('localhost:27017/%s', $this->appName), 'options' => array('connect' => true));
     $documentManagers = array();
     $connections = array();
     foreach ($config['document_managers'] as $name => $params) {
         $managerParams = array_merge($defaultManagerParams, $params);
         $documentManagers[$name] = $managerParams;
         $connectionName = $managerParams['connection'];
         if (isset($config['connections']) && isset($config['connections'][$connectionName])) {
             $conn = array_merge($defaultConnectionParams, $config['connections'][$connectionName]);
         } else {
             $conn = $defaultConnectionParams;
         }
         $connections[$connectionName] = $conn;
     }
     $defaultConfDef = $configuration->getDefinition('doctrine.odm.mongo.configuration');
     $defaultConnection = $configuration->getDefinition('doctrine.odm.mongo.connection');
     $defaultDocManager = $configuration->getDefinition('doctrine.odm.document_manager');
     if (count($documentManagers) > 1) {
         foreach ($documentManagers as $name => $connection) {
             $server = $connections[$connection['connection']]['server'];
             $options = $connections[$connection['connection']]['options'];
             $pieces = explode('/', $server);
             $db = isset($pieces[1]) ? $pieces[1] : null;
             $odmConfiguration = clone $defaultConfDef;
             $odmConfiguration->setClass($configuration->getParameter('doctrine.odm.mongo.configuration_class'));
             if (isset($db)) {
                 $odmConfiguration->addMethodCall('setDefaultDB', array($db));
             }
             $odmConnection = clone $defaultConnection;
             $odmConnection->setClass($configuration->getParameter('doctrine.odm.mongo_class'));
             $odmConnection->setArguments(array($server, $options));
             $configuration->setDefinition(sprintf('doctrine.odm.mongo.%s_connection', $name), $odmConnection);
             $configuration->setDefinition(sprintf('doctrine.odm.mongo.%s_configuration', $name), $odmConfiguration);
             $documentManager = clone $defaultDocManager;
             $documentManager->setClass($configuration->getParameter('doctrine.odm.mongo.document_manager_class'));
             $odmManagerArgs = array(new Reference(sprintf('doctrine.odm.mongo.%s_connection', $name)), new Reference(sprintf('doctrine.odm.mongo.%s_configuration', $name)));
             $documentManager->setArguments($odmManagerArgs);
             $configuration->setDefinition(sprintf('doctrine.odm.%s_document_manager', $name), $documentManager);
             if ($name == $config['default_document_manager']) {
                 $configuration->setAlias('doctrine.odm.document_manager', sprintf('doctrine.odm.%s_document_manager', $name));
             }
         }
     } else {
         list($name, $connection) = each($documentManagers);
         $server = $connections[$connection['connection']]['server'];
         $options = $connections[$connection['connection']]['options'];
         $pieces = explode('/', $server);
         $db = isset($pieces[1]) ? $pieces[1] : null;
         $configuration->setParameter('doctrine.odm.mongo.default_database', $db);
         $configuration->setParameter('doctrine.odm.mongo.default_server', $server);
         $configuration->setParameter('doctrine.odm.mongo.default_connection_options', $options);
         $configuration->setAlias(sprintf('doctrine.odm.%s_document_manager', $name), 'doctrine.odm.document_manager');
     }
     return $configuration;
 }
开发者ID:poulikov,项目名称:DoctrineMongoDBBundle,代码行数:93,代码来源:MongoDBExtension.php

示例9: testSetGetParameter

 /**
  * @covers Symfony\Components\DependencyInjection\BuilderConfiguration::getParameter
  * @covers Symfony\Components\DependencyInjection\BuilderConfiguration::setParameter
  */
 public function testSetGetParameter()
 {
     $configuration = new BuilderConfiguration(array(), new ParameterBag(array('foo' => 'bar')));
     $configuration->setParameter('bar', 'foo');
     $this->assertEquals('foo', $configuration->getParameter('bar'), '->setParameter() sets the value of a new parameter');
     $configuration->setParameter('foo', 'baz');
     $this->assertEquals('baz', $configuration->getParameter('foo'), '->setParameter() overrides previously set parameter');
     $configuration->setParameter('Foo', 'baz1');
     $this->assertEquals('baz1', $configuration->getParameter('foo'), '->setParameter() converts the key to lowercase');
     $this->assertEquals('baz1', $configuration->getParameter('FOO'), '->getParameter() converts the key to lowercase');
     try {
         $configuration->getParameter('baba');
         $this->fail('->getParameter() throws an \\InvalidArgumentException if the key does not exist');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\InvalidArgumentException', $e, '->getParameter() throws an \\InvalidArgumentException if the key does not exist');
         $this->assertEquals('The parameter "baba" must be defined.', $e->getMessage(), '->getParameter() throws an \\InvalidArgumentException if the key does not exist');
     }
 }
开发者ID:bill97420,项目名称:symfony,代码行数:22,代码来源:BuilderConfigurationTest.php

示例10: configLoad

 /**
  * Loads the web configuration.
  *
  * @param array                $config        A configuration array
  * @param BuilderConfiguration $configuration A BuilderConfiguration instance
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function configLoad($config, BuilderConfiguration $configuration)
 {
     if (!$configuration->hasDefinition('controller_manager')) {
         $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
         $configuration->merge($loader->load($this->resources['web']));
     }
     if (isset($config['ide']) && 'textmate' === $config['ide']) {
         $configuration->setParameter('debug.file_link_format', 'txmt://open?url=file://%%f&line=%%l');
     }
     if (isset($config['toolbar']) && $config['toolbar']) {
         $config['profiler'] = true;
     }
     if (isset($config['profiler'])) {
         if ($config['profiler']) {
             if (!$configuration->hasDefinition('profiler')) {
                 $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
                 $configuration->merge($loader->load('profiling.xml'));
             }
         } elseif ($configuration->hasDefinition('profiler')) {
             $configuration->getDefinition('profiling')->clearAnnotations();
         }
     }
     // toolbar need to be registered after the profiler
     if (isset($config['toolbar'])) {
         if ($config['toolbar']) {
             if (!$configuration->hasDefinition('debug.toolbar')) {
                 $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
                 $configuration->merge($loader->load('toolbar.xml'));
             }
         } elseif ($configuration->hasDefinition('debug.toolbar')) {
             $configuration->getDefinition('debug.toolbar')->clearAnnotations();
         }
     }
     if (isset($config['validation'])) {
         if ($config['validation']) {
             if (!$configuration->hasDefinition('validator')) {
                 $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
                 $configuration->merge($loader->load($this->resources['validation']));
             }
             $xmlMappingFiles = array();
             $yamlMappingFiles = array();
             $messageFiles = array();
             // default entries by the framework
             $xmlMappingFiles[] = __DIR__ . '/../../../Components/Form/Resources/config/validation.xml';
             $messageFiles[] = __DIR__ . '/../../../Components/Validator/Resources/i18n/messages.en.xml';
             $messageFiles[] = __DIR__ . '/../../../Components/Form/Resources/i18n/messages.en.xml';
             foreach ($this->bundles as $className) {
                 $tmp = dirname(str_replace('\\', '/', $className));
                 $namespace = str_replace('/', '\\', dirname($tmp));
                 $bundle = basename($tmp);
                 foreach ($this->bundleDirs as $dir) {
                     if (file_exists($file = $dir . '/' . $bundle . '/Resources/config/validation.xml')) {
                         $xmlMappingFiles[] = realpath($file);
                     }
                     if (file_exists($file = $dir . '/' . $bundle . '/Resources/config/validation.yml')) {
                         $yamlMappingFiles[] = realpath($file);
                     }
                     // TODO do we really want the message files of all cultures?
                     foreach (glob($dir . '/' . $bundle . '/Resources/i18n/messages.*.xml') as $file) {
                         $messageFiles[] = realpath($file);
                     }
                 }
             }
             $xmlFilesLoader = new Definition($configuration->getParameter('validator.mapping.loader.xml_files_loader.class'), array($xmlMappingFiles));
             $yamlFilesLoader = new Definition($configuration->getParameter('validator.mapping.loader.yaml_files_loader.class'), array($yamlMappingFiles));
             $configuration->setDefinition('validator.mapping.loader.xml_files_loader', $xmlFilesLoader);
             $configuration->setDefinition('validator.mapping.loader.yaml_files_loader', $yamlFilesLoader);
             $configuration->setParameter('validator.message_interpolator.files', $messageFiles);
             foreach ($xmlMappingFiles as $file) {
                 $configuration->addResource(new FileResource($file));
             }
             foreach ($yamlMappingFiles as $file) {
                 $configuration->addResource(new FileResource($file));
             }
             foreach ($messageFiles as $file) {
                 $configuration->addResource(new FileResource($file));
             }
             if (isset($config['validation']['annotations']) && $config['validation']['annotations'] === true) {
                 $annotationLoader = new Definition($configuration->getParameter('validator.mapping.loader.annotation_loader.class'));
                 $configuration->setDefinition('validator.mapping.loader.annotation_loader', $annotationLoader);
                 $loader = $configuration->getDefinition('validator.mapping.loader.loader_chain');
                 $arguments = $loader->getArguments();
                 array_unshift($arguments, new Reference('validator.mapping.loader.annotation_loader'));
                 $loader->setArguments($arguments);
             }
         } elseif ($configuration->hasDefinition('validator')) {
             $configuration->getDefinition('validator')->clearAnnotations();
         }
     }
     return $configuration;
 }
开发者ID:pgodel,项目名称:PageRoller,代码行数:99,代码来源:WebExtension.php


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