DDC-1900: Impossibility to override built-in SQL functions #2395

Closed
opened 2026-01-22 13:51:35 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 30, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user lex0r:

Doctrine doesn't allow to to create own SQL function for DQL if that function is already defined as "built-in". An example could be custom DATE_ADD implementation.
Method FunctionDeclaration() in Doctrine\ORM\Query\Parser gives higher priority to built-in SQL functions, even if they are not
usable for a specific situation, and registering of own datetime function doesn't help. This issue makes it impossible to use some advanced Doctrine extensions,
for example https://github.com/beberlei/DoctrineExtensions that provide fuller implementations.
Considering the fact that someone may want to use ready components provided by the community, and being new to Doctrine can't figure out the way to hack
or workaround this, the issue is a major one.

Originally created by @doctrinebot on GitHub (Jun 30, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user lex0r: Doctrine doesn't allow to to create own SQL function for DQL if that function is already defined as "built-in". An example could be custom `DATE_ADD` implementation. Method `FunctionDeclaration()` in _Doctrine\ORM\Query\Parser_ gives higher priority to built-in SQL functions, even if they are not usable for a specific situation, and registering of own datetime function doesn't help. This issue makes it impossible to use some advanced Doctrine extensions, for example https://github.com/beberlei/DoctrineExtensions that provide fuller implementations. Considering the fact that someone may want to use ready components provided by the community, and being new to Doctrine can't figure out the way to hack or workaround this, the issue is a major one.
admin added the Bug label 2026-01-22 13:51:35 +01:00
admin closed this issue 2026-01-22 13:51:36 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 4, 2012):

Comment created by @beberlei:

Just name the method differently.

@doctrinebot commented on GitHub (Jul 4, 2012): Comment created by @beberlei: Just name the method differently.
Author
Owner

@doctrinebot commented on GitHub (Jul 5, 2012):

Comment created by lex0r:

To rename the method one has to KNOW that he has to rename it, i.e. to know about this issue.
One has to SPEND hours (like me) on understanding that there are built-in implementations and other extensions that are meant
to provide necessary features just don't work. IMHO it's just too cruel to leave it as is.

As to the renaming: is it ok to go and edit source code (change class name at least) provided by someone else and then merge all the sources when new releases appear?
Is that the only way flexible Doctrine provides? Also, I want DQL to be as close as possible to real SQL. I don't want to see weird stuff like MY_DATE_ADD or BETTER_DATE_ADD, or whatever it will be.
Syntax matters, we are all writers, code writers...

I re-open the issue in order to attract more attention, but you are free to decide how to treat it. Hope you'll find the best solution. A short line in documentation could notify about current limitations and save hours for people
who want to be productive with Doctrine.

@doctrinebot commented on GitHub (Jul 5, 2012): Comment created by lex0r: To rename the method one has to **KNOW** that he has to rename it, i.e. to know about this issue. One has to **SPEND hours** (like me) on understanding that there are built-in implementations and other extensions that are meant to provide necessary features just don't work. IMHO it's just too cruel to leave it as is. As to the renaming: is it ok to go and edit source code (change class name at least) provided by someone else and then merge all the sources when new releases appear? Is that the only way flexible Doctrine provides? Also, I want DQL to be as close as possible to real SQL. I don't want to see weird stuff like MY_DATE_ADD or BETTER_DATE_ADD, or whatever it will be. Syntax matters, we are all writers, code writers... I re-open the issue in order to attract more attention, but you are free to decide how to treat it. Hope you'll find the best solution. A short line in documentation could notify about current limitations and save hours for people who want to be productive with Doctrine.
Author
Owner

@doctrinebot commented on GitHub (Jul 5, 2012):

Comment created by @beberlei:

Printing statements in bold isnt helpful. This is open-source.

However, you are right that this could be more user-friendly. Its now throwing an exception when an internal function is attempted to be overwritten.

@doctrinebot commented on GitHub (Jul 5, 2012): Comment created by @beberlei: Printing statements in bold isnt helpful. This is open-source. However, you are right that this could be more user-friendly. Its now throwing an exception when an internal function is attempted to be overwritten.
Author
Owner

@doctrinebot commented on GitHub (Jul 5, 2012):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jul 5, 2012): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2395