Skip to content

Commit 46671ce

Browse files
committed
Merge pull request #3335 from FlorianLB/config_dql
Change Register DQL config
2 parents 08d95b2 + fd4f4f2 commit 46671ce

File tree

1 file changed

+24
-37
lines changed

1 file changed

+24
-37
lines changed

cookbook/doctrine/custom_dql_functions.rst

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ In Symfony, you can register your custom DQL functions as follows:
1717
doctrine:
1818
orm:
1919
# ...
20-
entity_managers:
21-
default:
22-
# ...
23-
dql:
24-
string_functions:
25-
test_string: Acme\HelloBundle\DQL\StringFunction
26-
second_string: Acme\HelloBundle\DQL\SecondStringFunction
27-
numeric_functions:
28-
test_numeric: Acme\HelloBundle\DQL\NumericFunction
29-
datetime_functions:
30-
test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
20+
dql:
21+
string_functions:
22+
test_string: Acme\HelloBundle\DQL\StringFunction
23+
second_string: Acme\HelloBundle\DQL\SecondStringFunction
24+
numeric_functions:
25+
test_numeric: Acme\HelloBundle\DQL\NumericFunction
26+
datetime_functions:
27+
test_datetime: Acme\HelloBundle\DQL\DatetimeFunction
3128
3229
.. code-block:: xml
3330
@@ -41,15 +38,12 @@ In Symfony, you can register your custom DQL functions as follows:
4138
<doctrine:config>
4239
<doctrine:orm>
4340
<!-- ... -->
44-
<doctrine:entity-manager name="default">
45-
<!-- ... -->
46-
<doctrine:dql>
47-
<doctrine:string-function name="test_string>Acme\HelloBundle\DQL\StringFunction</doctrine:string-function>
48-
<doctrine:string-function name="second_string>Acme\HelloBundle\DQL\SecondStringFunction</doctrine:string-function>
49-
<doctrine:numeric-function name="test_numeric>Acme\HelloBundle\DQL\NumericFunction</doctrine:numeric-function>
50-
<doctrine:datetime-function name="test_datetime>Acme\HelloBundle\DQL\DatetimeFunction</doctrine:datetime-function>
51-
</doctrine:dql>
52-
</doctrine:entity-manager>
41+
<doctrine:dql>
42+
<doctrine:string-function name="test_string>Acme\HelloBundle\DQL\StringFunction</doctrine:string-function>
43+
<doctrine:string-function name="second_string>Acme\HelloBundle\DQL\SecondStringFunction</doctrine:string-function>
44+
<doctrine:numeric-function name="test_numeric>Acme\HelloBundle\DQL\NumericFunction</doctrine:numeric-function>
45+
<doctrine:datetime-function name="test_datetime>Acme\HelloBundle\DQL\DatetimeFunction</doctrine:datetime-function>
46+
</doctrine:dql>
5347
</doctrine:orm>
5448
</doctrine:config>
5549
</container>
@@ -60,23 +54,16 @@ In Symfony, you can register your custom DQL functions as follows:
6054
$container->loadFromExtension('doctrine', array(
6155
'orm' => array(
6256
// ...
63-
64-
'entity_managers' => array(
65-
'default' => array(
66-
// ...
67-
68-
'dql' => array(
69-
'string_functions' => array(
70-
'test_string' => 'Acme\HelloBundle\DQL\StringFunction',
71-
'second_string' => 'Acme\HelloBundle\DQL\SecondStringFunction',
72-
),
73-
'numeric_functions' => array(
74-
'test_numeric' => 'Acme\HelloBundle\DQL\NumericFunction',
75-
),
76-
'datetime_functions' => array(
77-
'test_datetime' => 'Acme\HelloBundle\DQL\DatetimeFunction',
78-
),
79-
),
57+
'dql' => array(
58+
'string_functions' => array(
59+
'test_string' => 'Acme\HelloBundle\DQL\StringFunction',
60+
'second_string' => 'Acme\HelloBundle\DQL\SecondStringFunction',
61+
),
62+
'numeric_functions' => array(
63+
'test_numeric' => 'Acme\HelloBundle\DQL\NumericFunction',
64+
),
65+
'datetime_functions' => array(
66+
'test_datetime' => 'Acme\HelloBundle\DQL\DatetimeFunction',
8067
),
8168
),
8269
),

0 commit comments

Comments
 (0)