Skip to content

Commit

Permalink
[DoctrineBundle] Allowed to configure dql functions without using the…
Browse files Browse the repository at this point in the history
… multiple entity mangers syntax
  • Loading branch information
noelg committed Jul 18, 2011
1 parent 634131b commit 872d308
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Expand Up @@ -163,7 +163,7 @@ private function addOrmSection(ArrayNodeDefinition $node)
'query_cache_driver', 'query-cache-driver',
'auto_mapping', 'auto-mapping',
'mappings', 'mapping',
'connection'
'connection', 'dql'
) as $key) {
if (array_key_exists($key, $v)) {
$entityManager[$key] = $v[$key];
Expand Down
Expand Up @@ -661,6 +661,19 @@ public function testSetCustomFunctions()
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomDatetimeFunction', array('test_datetime', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction'));
}

public function testSingleEMSetCustomFunctions()
{
$container = $this->getContainer(array('YamlBundle'));

$loader = new DoctrineExtension();
$container->registerExtension($loader);
$this->loadFromFile($container, 'orm_single_em_dql_functions');
$this->compileContainer($container);

$definition = $container->getDefinition('doctrine.orm.default_configuration');
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomStringFunction', array('test_string', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction'));
}

public function testAddCustomHydrationMode()
{
$container = $this->getContainer(array('YamlBundle'));
Expand Down
@@ -0,0 +1,12 @@
doctrine:
dbal:
default_connection: default
connections:
default:
dbname: db

orm:
dql:
string_functions:
test_string: Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestStringFunction

0 comments on commit 872d308

Please sign in to comment.