當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。