@@ -460,19 +460,22 @@ that use this connection.
460460 </services >
461461 </container >
462462
463- Registering custom DQL functions
463+ Registering Custom DQL Functions
464464~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
465465
466- You can register custom DQL functions throught the configuration.
466+ You can register custom DQL functions through the configuration.
467467
468468.. configuration-block ::
469469
470470 .. code-block :: yaml
471471
472+ # app/config/config.yml
472473 doctrine :
473474 orm :
475+ # ...
474476 entity_managers :
475477 default :
478+ # ...
476479 dql :
477480 string_functions :
478481 test_string : Acme\HelloBundle\DQL\StringFunction
@@ -484,6 +487,7 @@ You can register custom DQL functions throught the configuration.
484487
485488 .. code-block :: xml
486489
490+ <!-- app/config/config.xml -->
487491 <container xmlns =" http://symfony.com/schema/dic/services"
488492 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
489493 xmlns : doctrine =" http://symfony.com/schema/dic/doctrine"
@@ -492,7 +496,9 @@ You can register custom DQL functions throught the configuration.
492496
493497 <doctrine : config >
494498 <doctrine : orm >
499+ <!-- ... -->
495500 <doctrine : entity-manager name =" default" >
501+ <!-- ... -->
496502 <doctrine : dql >
497503 <doctrine : string-function name =" test_string>Acme\HelloBundle\DQL\StringFunction</doctrine:string-function>
498504 <doctrine:string-function name=" second_string>Acme\HelloBundle\DQL\SecondStringFunction</doctrine : string-function >
@@ -504,6 +510,32 @@ You can register custom DQL functions throught the configuration.
504510 </doctrine : config >
505511 </container >
506512
513+ .. code-block :: php
514+
515+ // app/config/config.php
516+ $container->loadFromExtension('doctrine', array(
517+ 'orm' => array(
518+ // ...
519+ 'entity_managers' => array(
520+ 'default' => array(
521+ // ...
522+ 'dql' => array(
523+ 'string_functions' => array(
524+ 'test_string' => 'Acme\HelloBundle\DQL\StringFunction',
525+ 'second_string' => 'Acme\HelloBundle\DQL\SecondStringFunction',
526+ ),
527+ 'numeric_functions' => array(
528+ 'test_numeric' => 'Acme\HelloBundle\DQL\NumericFunction',
529+ ),
530+ 'datetime_functions' => array(
531+ 'test_datetime' => 'Acme\HelloBundle\DQL\DatetimeFunction',
532+ ),
533+ ),
534+ ),
535+ ),
536+ ),
537+ ));
538+
507539 .. index ::
508540 single: Doctrine; ORM Console Commands
509541 single: CLI; Doctrine ORM
0 commit comments