Skip to content

Commit

Permalink
[DoctrineBundle] removed the possibility to define an empty configura…
Browse files Browse the repository at this point in the history
…tion for the DBAL (which does not make sense in real-life)
  • Loading branch information
fabpot committed Apr 27, 2011
1 parent 55f9e6f commit 03511de
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
Expand Up @@ -58,11 +58,6 @@ private function addDbalSection(ArrayNodeDefinition $node)
$node
->children()
->arrayNode('dbal')
->beforeNormalization()
->ifNull()
// Define a default connection using the default values
->then(function($v) { return array ('connections' => array('default' => array())); })
->end()
->children()
->scalarNode('default_connection')->end()
->end()
Expand Down
Expand Up @@ -41,7 +41,7 @@ public function testDbalLoad()
$container = $this->getContainer();
$loader = new DoctrineExtension();

$loader->load(array(array('dbal' => array('connections' => array('default'=> array('password' => 'foo')))), array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo')))), array(), array('dbal' => array('default_connection' => 'foo')), array()), $container);

$arguments = $container->getDefinition('doctrine.dbal.default_connection')->getArguments();
$config = $arguments[0];
Expand Down Expand Up @@ -109,7 +109,7 @@ public function testDependencyInjectionConfigurationDefaults()
$container = $this->getContainer();
$loader = new DoctrineExtension();

$loader->load(array(array('dbal' => null, 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);

$this->assertFalse($container->getParameter('doctrine.orm.auto_generate_proxy_classes'));
$this->assertEquals('Doctrine\ORM\Configuration', $container->getParameter('doctrine.orm.configuration.class'));
Expand Down Expand Up @@ -140,7 +140,7 @@ public function testDependencyInjectionConfigurationDefaults()
);

$container = $this->getContainer();
$loader->load(array(array('dbal' => null, 'orm' => $config)), $container);
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => $config)), $container);
$this->compileContainer($container);

$definition = $container->getDefinition('doctrine.dbal.default_connection');
Expand Down Expand Up @@ -189,7 +189,7 @@ public function testSingleEntityManagerConfiguration()
$container = $this->getContainer();
$loader = new DoctrineExtension();

$loader->load(array(array('dbal' => null, 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
$loader->load(array(array('dbal' => array('connections' => array('default' => array('password' => 'foo'))), 'orm' => array('default_entity_manager' => 'default', 'entity_managers' => array('default' => array('mappings' => array('YamlBundle' => array())))))), $container);
$this->compileContainer($container);

$definition = $container->getDefinition('doctrine.dbal.default_connection');
Expand Down Expand Up @@ -221,13 +221,14 @@ public function testLoadSimpleSingleConnection()

$this->assertDICConstructorArguments($definition, array(
array(
'dbname' => 'db',
'host' => 'localhost',
'driver' => 'pdo_mysql',
'driverOptions' => array(),
'port' => null,
'user' => 'root',
'password' => null,
'port' => null,
'driver' => 'pdo_mysql',
'logging' => false,
'driverOptions' => array(),
),
new Reference('doctrine.dbal.default_connection.configuration'),
new Reference('doctrine.dbal.default_connection.event_manager')
Expand Down
Expand Up @@ -7,7 +7,10 @@
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<config>
<dbal />
<dbal default-connection="default">
<connection name="default" dbname="db" />
</dbal>

<orm default-entity-manager="default">
<entity-manager name="default">
<metadata-cache-driver type="memcache">
Expand Down
Expand Up @@ -7,6 +7,10 @@
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">

<config>
<dbal default-connection="default">
<connection name="default" dbname="db" />
</dbal>

<orm default-entity-manager="default">
<entity-manager name="default">
<mapping name="AnnotationsBundle" />
Expand Down
@@ -1,5 +1,10 @@
doctrine:
dbal: ~
dbal:
default_connection: default
connections:
default:
dbname: db

orm:
default_entity_manager: default
entity_managers:
Expand Down
@@ -1,4 +1,10 @@
doctrine:
dbal:
default_connection: default
connections:
default:
dbname: db

orm:
default_entity_manager: default
entity_managers:
Expand Down

0 comments on commit 03511de

Please sign in to comment.