Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0.4
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
There are perfectly legitimate situations where the same value needs to be used at various places within a single query (e. g. to compare various versioned artifacts against a common revision number, while joining them). However, specifying the same parameter name twice within a DQL query currently results in a fatal error:
Warning: array_combine(): Both parameters should have an equal number of elements in /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query.php on line 252 Fatal error: Unsupported operand types in /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query.php on line 252
It is possible to work around this by just giving each parameter a unique name. Unfortunately, it becomes an impossibility when using generated DQL statements, e.g. when a correlated subquery is replicated multiple times within the same DQL query.
I can not think of a convincing reason to allow each parameter to appear only once in a query, as the number of parameters could be determined as well by counting the number of unique names rather than simply all names.
Would it be possible to relax the restriction? It would remove a massive burden on dynamically building queries, as currently all parameter names have to be adapted to every single situation, and that would be no longer an issue, if multiple parameters with the same name would be allowed and correctly handled by Doctrine 2.
Apart from the functional requirement, I don't like the crashing effect. If such use is forbidden, it should be officially so (with the documentation at least mentioning the restriction and Doctrine 2 giving an understandable error message when used wrongly, instead of crashing).
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | ddc1040.diff [ 10946 ] |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0.3 [ 10117 ] | |
| Resolution | Fixed [ 1 ] |
| Fix Version/s | 2.0.4 [ 10130 ] | |
| Fix Version/s | 2.0.3 [ 10117 ] |
| Workflow | jira [ 12411 ] | jira-feedback [ 14770 ] |
| Workflow | jira-feedback [ 14770 ] | jira-feedback2 [ 16634 ] |
| Workflow | jira-feedback2 [ 16634 ] | jira-feedback3 [ 18887 ] |
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1040, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
Currently, I automatically post-process all queries so that all parameters are assigned new (unique) names. This way, even the multiple replicated subqueries within the same DQL query will end up having unique parameter names. While this works, it is clumsy as a general approach.