fixed previous commit

This commit is contained in:
Fabien Potencier 2010-07-20 16:40:57 +02:00
parent 3f270f5faa
commit ef401180a7
6 changed files with 31 additions and 26 deletions

View File

@ -2,31 +2,35 @@
$container->setParameter('kernel.include_core_classes', false);
$container->getExtension('kernel')->load('config', array(
$container->loadFromExtension('kernel', 'config', array(
'charset' => 'UTF-8',
'error_handler_level' => null,
), $container);
));
$container->getExtension('web')->load('config', array(
$container->loadFromExtension('kernel', 'config', array(
'charset' => 'UTF-8',
'error_handler_level' => null,
));
$container->loadFromExtension('web', 'config', array(
'router' => array('resource' => '%kernel.root_dir%/config/routing.php'),
), $container);
));
$container->getExtension('web')->load('templating', array(
$container->loadFromExtension('web', 'templating', array(
'escaping' => "htmlspecialchars",
'assets_version' => "SomeVersionScheme",
), $container);
));
$container->getExtension('doctrine')->load('dbal', array(
$container->loadFromExtension('doctrine', 'dbal', array(
'dbname' => 'xxxxxxxx',
'user' => 'root',
'password' => '',
), $container);
));
$container->getExtension('doctrine')->load('orm', array(
), $container);
$container->loadFromExtension('doctrine', 'orm', array());
$container->getExtension('swift')->load('mailer', array(
$container->loadFromExtension('swift', 'mailer', array(
'transport' => "gmail",
'username' => "xxxxxxxx",
'password' => "xxxxxxxx",
), $container);
));

View File

@ -2,11 +2,11 @@
$loader->import('config.php');
$container->getExtension('zend')->load('logger', array(
$container->loadFromExtension('zend', 'logger', array(
'priority' => 'info',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
), $container);
));
$container->getExtension('web')->load('config', array(
$container->loadFromExtension('web', 'config', array(
'toolbar' => true,
), $container);
));

View File

@ -2,9 +2,9 @@
$loader->import('config_dev.php');
$container->getExtension('web')->load('config', array(
$container->loadFromExtension('web', 'config', array(
'toolbar' => false,
), $container);
));
$container->getExtension('kernel')->load('test', array(
), $container);
$container->loadFromExtension('kernel', 'test', array(
));

View File

@ -104,18 +104,19 @@ class ContainerBuilder extends Container implements AnnotatedContainerInterface
/**
* Loads the configuration for an extension.
*
* @param ExtensionInterface $extension A ExtensionInterface instance
* @param string $tag The extension tag to load (without the namespace - namespace.tag)
* @param array $values An array of values that customizes the extension
* @param string $extension The extension alias or namespace
* @param string $tag The extension tag to load (without the namespace - namespace.tag)
* @param array $values An array of values that customizes the extension
*
* @return ContainerBuilder The current instance
*/
public function loadFromExtension(ExtensionInterface $extension, $tag, array $values = array())
public function loadFromExtension($extension, $tag, array $values = array())
{
if (true === $this->isFrozen()) {
throw new \LogicException('Cannot load from an extension on a frozen container.');
}
$extension = $this->getExtension($extension);
$namespace = $extension->getAlias();
$this->addObjectResource($extension);

View File

@ -312,7 +312,7 @@ EOF
$values = array();
}
$this->container->loadFromExtension($this->container->getExtension($node->namespaceURI), $node->localName, $values);
$this->container->loadFromExtension($node->namespaceURI, $node->localName, $values);
}
}

View File

@ -223,7 +223,7 @@ class YamlFileLoader extends FileLoader
$values = array();
}
$this->container->loadFromExtension($this->container->getExtension($namespace), $tag, $values);
$this->container->loadFromExtension($namespace, $tag, $values);
}
}
}