From 806310a10c8cb8e35182ab7871329eddaa4807bd Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sun, 10 Apr 2022 10:56:52 +0200 Subject: [PATCH] Adding caution box on dependecy injection I guessed this (based on trial and error), so please double-check! Maybe add a second sentence like: The reason is that the class is instantiated by Doctrine and not wired through Symfony's DI container. --- doctrine/custom_dql_functions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doctrine/custom_dql_functions.rst b/doctrine/custom_dql_functions.rst index ee11967da47..974ee11987f 100644 --- a/doctrine/custom_dql_functions.rst +++ b/doctrine/custom_dql_functions.rst @@ -146,4 +146,8 @@ In Symfony, you can register your custom DQL functions as follows: ], ]); +.. caution:: + + It is not possible to inject Symfony services or parameters into a custom DQL function. + .. _`DQL User Defined Functions`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/cookbook/dql-user-defined-functions.html