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


PHP DependencyInjection\BuilderConfiguration类代码示例

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


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

示例1: barLoad

 public function barLoad(array $config)
 {
     $configuration = new BuilderConfiguration();
     $configuration->setDefinition('project.service.bar', new Definition('FooClass'));
     $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar');
     return $configuration;
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:7,代码来源:ProjectExtension.php

示例2: 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']));
     return $configuration;
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:14,代码来源:DoctrineExtension.php

示例3: buildContainer

 public function buildContainer(ContainerInterface $container)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/Resources/config');
     $configuration->merge($loader->load('config.xml'));
     $configuration->merge($loader->load('logger.xml'));
     return $configuration;
 }
开发者ID:Austin-Pray,项目名称:lichess,代码行数:8,代码来源:Bundle.php

示例4: 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

示例5: 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

示例6: odmLoad

 public function odmLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $defaultConfiguration = array_merge(array('connection' => 'mongodb://localhost:27017', 'params' => array('connected' => true)), $config);
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->setParameter('mongo.connection', $defaultConfiguration['connection']);
     $configuration->setParameter('mongo.params', $defaultConfiguration['params']);
     $configuration->merge($loader->load($this->resources['odm']));
     return $configuration;
 }
开发者ID:poulikov,项目名称:MongoDBBundle,代码行数:10,代码来源:MongoExtension.php

示例7: configLoad

 public function configLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load('collectors.xml'));
     if (isset($config['toolbar']) && $config['toolbar']) {
         $configuration->merge($loader->load('toolbar.xml'));
     }
     return $configuration;
 }
开发者ID:CodingFabian,项目名称:symfony,代码行数:10,代码来源:ProfilerExtension.php

示例8: merge

 /**
  * Merges a BuilderConfiguration with the current one.
  *
  * @param BuilderConfiguration $configuration
  *
  * @return BuilderConfiguration The current instance
  */
 public function merge(BuilderConfiguration $configuration = null)
 {
     if (null === $configuration) {
         return;
     }
     $this->addDefinitions($configuration->getDefinitions());
     $this->addAliases($configuration->getAliases());
     $this->addParameters($configuration->getParameters());
     foreach ($configuration->getResources() as $resource) {
         $this->addResource($resource);
     }
     return $this;
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:20,代码来源:BuilderConfiguration.php

示例9: execute

 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $kernel = $this->container->getKernelService();
     $container = new Builder($kernel->getDefaultParameters());
     $configuration = new BuilderConfiguration();
     foreach ($kernel->getBundles() as $bundle) {
         $configuration->merge($bundle->buildContainer($container));
     }
     $configuration->merge($kernel->registerContainerConfiguration());
     $container->merge($configuration);
     $kernel->optimizeContainer($container);
     $container->setService('kernel', $kernel);
     $dumper = new GraphvizDumper($container);
     $output->write($dumper->dump(), Output::OUTPUT_RAW);
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:18,代码来源:ContainerGraphvizCommand.php

示例10: buildContainer

 /**
  * Customizes the Container instance.
  *
  * @param Symfony\Components\DependencyInjection\ContainerInterface $container A ContainerInterface instance
  *
  * @return Symfony\Components\DependencyInjection\BuilderConfiguration A BuilderConfiguration instance
  */
 public function buildContainer(ContainerInterface $container)
 {
     Loader::registerExtension(new WebExtension($container->getParameter('kernel.bundle_dirs'), $container->getParameter('kernel.bundles')));
     $dirs = array('%kernel.root_dir%/views/%%bundle%%/%%controller%%/%%name%%%%format%%.%%renderer%%');
     foreach ($container->getParameter('kernel.bundle_dirs') as $dir) {
         $dirs[] = $dir . '/%%bundle%%/Resources/views/%%controller%%/%%name%%%%format%%.%%renderer%%';
     }
     $container->setParameter('templating.loader.filesystem.path', $dirs);
     $configuration = new BuilderConfiguration();
     if ($container->getParameter('kernel.debug')) {
         $loader = new XmlFileLoader(__DIR__ . '/Resources/config');
         $configuration->merge($loader->load('debug.xml'));
     }
     return $configuration;
 }
开发者ID:pgodel,项目名称:PageRoller,代码行数:22,代码来源:FoundationBundle.php

示例11: load

 /**
  * Loads a resource.
  *
  * @param  string $file An INI file path
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  *
  * @throws \InvalidArgumentException When ini file is not valid
  */
 public function load($file)
 {
     $path = $this->findFile($file);
     $configuration = new BuilderConfiguration();
     $configuration->addResource(new FileResource($path));
     $result = parse_ini_file($path, true);
     if (false === $result || array() === $result) {
         throw new \InvalidArgumentException(sprintf('The %s file is not valid.', $file));
     }
     if (isset($result['parameters']) && is_array($result['parameters'])) {
         foreach ($result['parameters'] as $key => $value) {
             $configuration->setParameter(strtolower($key), $value);
         }
     }
     return $configuration;
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:25,代码来源:IniFileLoader.php

示例12: debugLoad

 public function debugLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load($this->resources['debug']));
     if (isset($config['exception']) && $config['exception']) {
         $configuration->merge($loader->load('debug_exception_handler.xml'));
     }
     if (isset($config['toolbar']) && $config['toolbar']) {
         $configuration->merge($loader->load('debug_data_collector.xml'));
         $configuration->merge($loader->load('debug_web_debug_toolbar.xml'));
     }
     if (isset($config['ide']) && 'textmate' === $config['ide']) {
         $configuration->setParameter('web_debug.file_link_format', 'txmt://open?url=file://%%f&line=%%l');
     }
     $configuration->setAlias('event_dispatcher', 'debug.event_dispatcher');
     return $configuration;
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:18,代码来源:WebExtension.php

示例13: configLoad

 public function configLoad($config, BuilderConfiguration $configuration)
 {
     if (isset($config['charset'])) {
         $configuration->setParameter('kernel.charset', $config['charset']);
     }
     if (!array_key_exists('compilation', $config)) {
         $classes = array('Symfony\\Components\\Routing\\Router', 'Symfony\\Components\\Routing\\RouterInterface', 'Symfony\\Components\\EventDispatcher\\Event', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcherInterface', 'Symfony\\Components\\Routing\\Matcher\\UrlMatcher', 'Symfony\\Components\\HttpKernel\\HttpKernel', 'Symfony\\Components\\HttpKernel\\Request', 'Symfony\\Components\\HttpKernel\\Response', 'Symfony\\Components\\HttpKernel\\ResponseListener', 'Symfony\\Components\\Templating\\Loader\\LoaderInterface', 'Symfony\\Components\\Templating\\Loader\\Loader', 'Symfony\\Components\\Templating\\Loader\\FilesystemLoader', 'Symfony\\Components\\Templating\\Engine', 'Symfony\\Components\\Templating\\Renderer\\RendererInterface', 'Symfony\\Components\\Templating\\Renderer\\Renderer', 'Symfony\\Components\\Templating\\Renderer\\PhpRenderer', 'Symfony\\Components\\Templating\\Storage\\Storage', 'Symfony\\Components\\Templating\\Storage\\FileStorage', 'Symfony\\Framework\\FrameworkBundle\\RequestListener', 'Symfony\\Framework\\FrameworkBundle\\Controller', 'Symfony\\Framework\\FrameworkBundle\\Controller\\ControllerLoaderListener', 'Symfony\\Framework\\FrameworkBundle\\Templating\\Engine');
     } else {
         $classes = array();
         foreach (explode("\n", $config['compilation']) as $class) {
             if ($class) {
                 $classes[] = trim($class);
             }
         }
     }
     $configuration->setParameter('kernel.compiled_classes', $classes);
     if (array_key_exists('error_handler_level', $config)) {
         $configuration->setParameter('error_handler.level', $config['error_handler_level']);
     }
     return $configuration;
 }
开发者ID:klaasn,项目名称:symfony-sandbox,代码行数:21,代码来源:KernelExtension.php

示例14: 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)
 {
     $configuration = new BuilderConfiguration();
     $loader = new XmlFileLoader(__DIR__ . '/../Resources/config');
     $configuration->merge($loader->load($this->resources['mailer']));
     if (isset($config['transport']) && null === $config['transport']) {
         $config['transport'] = 'null';
     } elseif (!isset($config['transport'])) {
         $config['transport'] = 'smtp';
     } elseif ('gmail' === $config['transport']) {
         $config['encryption'] = 'ssl';
         $config['auth_mode'] = 'login';
         $config['host'] = 'smtp.gmail.com';
         $config['transport'] = 'smtp';
     }
     $configuration->setAlias('swiftmailer.transport', 'swiftmailer.transport.' . $config['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.' . $config['transport'] . '.' . $key, $config[$key]);
         }
     }
     // spool?
     if (isset($config['spool'])) {
         $type = isset($config['type']) ? $config['type'] : 'file';
         $configuration->setAlias('swiftmailer.transport.real', 'swiftmailer.transport.' . $config['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]);
             }
         }
     }
     $configuration->setAlias('mailer', 'swiftmailer.mailer');
     return $configuration;
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:54,代码来源:SwiftmailerExtension.php

示例15: dbalLoad

 /**
  * Loads the DBAL configuration.
  *
  * @param array $config A configuration array
  *
  * @return BuilderConfiguration A BuilderConfiguration instance
  */
 public function dbalLoad($config)
 {
     $configuration = new BuilderConfiguration();
     $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')));
     $config['default_connection'] = isset($config['default_connection']) ? $config['default_connection'] : 'default';
     $connections = array();
     if (isset($config['connections'])) {
         foreach ($config['connections'] as $name => $connection) {
             $connections[isset($connection['id']) ? $connection['id'] : $name] = $connection;
         }
     } else {
         $connections = array($config['default_connection'] => $config);
     }
     $c = array('log' => array('level' => 7), 'datasources' => array());
     foreach ($connections as $name => $connection) {
         $connection = array_replace($defaultConnection, $connection);
         $c['datasources'][$name] = array('adapter' => $connection['driver'], 'connection' => array('dsn' => $connection['dsn'], 'user' => $connection['user'], 'password' => $connection['password'], 'classname' => $connection['classname'], 'options' => $connection['options'], 'attributes' => $connection['attributes'], 'settings' => $connection['settings']));
     }
     $configuration->getDefinition('propel.configuration')->setArguments(array($c));
     return $configuration;
 }
开发者ID:poulikov,项目名称:symfony,代码行数:30,代码来源:PropelExtension.php


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