[DoctrineBundle] Allowed to configure dql functions without using the multiple entity mangers syntax

This commit is contained in:
Noel GUILBERT 2011-07-18 19:51:17 +12:00
parent 634131bc77
commit 872d308e9c
3 changed files with 26 additions and 1 deletions

View File

@ -163,7 +163,7 @@ class Configuration implements ConfigurationInterface
'query_cache_driver', 'query-cache-driver', 'query_cache_driver', 'query-cache-driver',
'auto_mapping', 'auto-mapping', 'auto_mapping', 'auto-mapping',
'mappings', 'mapping', 'mappings', 'mapping',
'connection' 'connection', 'dql'
) as $key) { ) as $key) {
if (array_key_exists($key, $v)) { if (array_key_exists($key, $v)) {
$entityManager[$key] = $v[$key]; $entityManager[$key] = $v[$key];

View File

@ -661,6 +661,19 @@ abstract class AbstractDoctrineExtensionTest extends TestCase
$this->assertDICDefinitionMethodCallOnce($definition, 'addCustomDatetimeFunction', array('test_datetime', 'Symfony\Bundle\DoctrineBundle\Tests\DependencyInjection\TestDatetimeFunction')); $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() public function testAddCustomHydrationMode()
{ {
$container = $this->getContainer(array('YamlBundle')); $container = $this->getContainer(array('YamlBundle'));

View File

@ -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