DDC-134: Allow user-defined DQL builds #170

Closed
opened 2026-01-22 12:29:27 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 9, 2009).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user @guilhermeblanco:

We should allow a more flexible DQL system by enabling user defined grammars.

One good example is if the user wants to create several functions that are converted to custom queries.
Example: getUsers() => SELECT * FROM users u

Currently it's impossible because our QueryLanguage does not support that.
What should be done:
1- Create a chain of custom DQL support, so people can include multiple custom support
2- Update the method: Doctrine\ORM\Query\Parser::QueryLanguage, specially the default: clause to inspect for possible user defined support and forward to it.
If none of the chains (or there's no custom support), throw exception normally.

In the suggested situation, that would require the implementation of this grammar by user:
QueryLanguage ::= identifier "(" {FunctionParameter {"," FunctionParameter}}* ")"
FunctionParameter ::= Literal | InputParameter
Literal and InputParameter inherited from DQL parser.

That would convert to something like an SELECT statement. In the specific case of getUsers, it'll return a SELECT statement.
It's just one example of possible implementation inside DQL.
Another one could be something like:

CREATE User (property1="value", property2="value")

Which would launch an INSERT statement to Database.
In this second example, if correctly defined the grammar, we could support insertion of Entities via custom user support DQL.

Originally created by @doctrinebot on GitHub (Nov 9, 2009). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user @guilhermeblanco: We should allow a more flexible DQL system by enabling user defined grammars. One good example is if the user wants to create several functions that are converted to custom queries. Example: getUsers() => SELECT \* FROM users u Currently it's impossible because our QueryLanguage does not support that. What should be done: 1- Create a chain of custom DQL support, so people can include multiple custom support 2- Update the method: Doctrine\ORM\Query\Parser::QueryLanguage, specially the default: clause to inspect for possible user defined support and forward to it. If none of the chains (or there's no custom support), throw exception normally. In the suggested situation, that would require the implementation of this grammar by user: QueryLanguage ::= identifier "(" {FunctionParameter {"," FunctionParameter}}\* ")" FunctionParameter ::= Literal | InputParameter Literal and InputParameter inherited from DQL parser. That would convert to something like an SELECT statement. In the specific case of getUsers, it'll return a SELECT statement. It's just one example of possible implementation inside DQL. Another one could be something like: CREATE User (property1="value", property2="value") Which would launch an INSERT statement to Database. In this second example, if correctly defined the grammar, we could support insertion of Entities via custom user support DQL.
admin added the New Feature label 2026-01-22 12:29:27 +01:00
admin closed this issue 2026-01-22 12:29:27 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 14, 2010):

Comment created by @guilhermeblanco:

We dropped this support since user can extend our parser and implement his own support.

@doctrinebot commented on GitHub (Jan 14, 2010): Comment created by @guilhermeblanco: We dropped this support since user can extend our parser and implement his own support.
Author
Owner

@doctrinebot commented on GitHub (Jan 14, 2010):

Issue was closed with resolution "Won't Fix"

@doctrinebot commented on GitHub (Jan 14, 2010): Issue was closed with resolution "Won't Fix"
Author
Owner

@doctrinebot commented on GitHub (Dec 24, 2010):

Comment created by @beberlei:

Deschedule

@doctrinebot commented on GitHub (Dec 24, 2010): Comment created by @beberlei: Deschedule
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#170