DDC-1293: Update DQL function signature in documentation #1623

Closed
opened 2026-01-22 13:20:15 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 25, 2011).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user holtkamp:

The documentation concerning the new DQL Date functions is outdated, as the 'unit' of the interval is not described.

DATE_ADD(date, days) - Add the number of days to a given date.
DATE_SUB(date, days) - Substract the number of days from a given date.

Should be

DATE_ADD(date, interval, unitOfInterval)

for example:

DATE*ADD(CURRENT*DATE(), 1, 'DAY');
DATE*SUB(CURRENT*DATE(), 4, 'MONTH');

UPDATE: it appears parameters are not injected properly when using the DATE functions:

$qb->where("x.*lastMutationDateTime < DATE_ADD(CURRENT*DATE(),?1,'day')");
$qb->setParameter(1, 5);

Results in:

//DQL
SELECT x FROM Entity p WHERE x.*lastMutationTimestamp < DATE_ADD(CURRENT*DATE(),?1,'day')
//SQL:
SELECT x0*.id AS id0, x0_.last_mutation_timestamp AS last_mutation*timestamp1
WHERE x0*.last_mutation_timestamp < DATE_ADD(CURRENT*DATE, INTERVAL 0 DAY)
Originally created by @doctrinebot on GitHub (Jul 25, 2011). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user holtkamp: The [documentation concerning the new DQL Date functions](http://www.doctrine-project.org/docs/orm/2.1/en/reference/dql-doctrine-query-language.html#dql-functions) is outdated, as the 'unit' of the interval is not described. ``` DATE_ADD(date, days) - Add the number of days to a given date. DATE_SUB(date, days) - Substract the number of days from a given date. ``` Should be ``` DATE_ADD(date, interval, unitOfInterval) ``` for example: ``` DATE*ADD(CURRENT*DATE(), 1, 'DAY'); DATE*SUB(CURRENT*DATE(), 4, 'MONTH'); ``` UPDATE: it appears parameters are not injected properly when using the DATE functions: ``` $qb->where("x.*lastMutationDateTime < DATE_ADD(CURRENT*DATE(),?1,'day')"); $qb->setParameter(1, 5); ``` Results in: ``` //DQL SELECT x FROM Entity p WHERE x.*lastMutationTimestamp < DATE_ADD(CURRENT*DATE(),?1,'day') //SQL: SELECT x0*.id AS id0, x0_.last_mutation_timestamp AS last_mutation*timestamp1 WHERE x0*.last_mutation_timestamp < DATE_ADD(CURRENT*DATE, INTERVAL 0 DAY) ```
admin added the Bug label 2026-01-22 13:20:15 +01:00
admin closed this issue 2026-01-22 13:20:17 +01:00
Author
Owner

@doctrinebot commented on GitHub (Aug 27, 2011):

Comment created by @beberlei:

Marked as bug

@doctrinebot commented on GitHub (Aug 27, 2011): Comment created by @beberlei: Marked as bug
Author
Owner

@doctrinebot commented on GitHub (Dec 9, 2011):

Comment created by @guilhermeblanco:

This issue was already fixed, maybe docs should be regenerated.
Marking as fixed for now.

@doctrinebot commented on GitHub (Dec 9, 2011): Comment created by @guilhermeblanco: This issue was already fixed, maybe docs should be regenerated. Marking as fixed for now.
Author
Owner

@doctrinebot commented on GitHub (Dec 9, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 9, 2011): 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#1623