DDC-901: Docs DQL Custom Walkers CountSqlWalker example error #1120

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

Originally created by @doctrinebot on GitHub (Nov 29, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user cgmartin:

Getting invalid SQL when using the CountSqlWalker example in the DQL Custom Walkers docs:

SELECT count(DISTINCT z0_.) AS sclr0 FROM ...

From what looks like this part of the example:

...
$pathExpression = new PathExpression(
    PathExpression::TYPE*STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED*ASSOCIATION, $parentName, array(
    $parent['metadata']->getSingleIdentifierFieldName())
);
...

If you move the field name (3rd parameter) out of the array, it seems to work:

...
$pathExpression = new PathExpression(
    PathExpression::TYPE*STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED*ASSOCIATION, $parentName, 
    $parent['metadata']->getSingleIdentifierFieldName()
);
...
SELECT count(DISTINCT z0_.id) AS sclr0 FROM ...
Originally created by @doctrinebot on GitHub (Nov 29, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user cgmartin: Getting invalid SQL when using the CountSqlWalker example in the DQL Custom Walkers docs: ``` SELECT count(DISTINCT z0_.) AS sclr0 FROM ... ``` From what looks like this part of the example: ``` ... $pathExpression = new PathExpression( PathExpression::TYPE*STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED*ASSOCIATION, $parentName, array( $parent['metadata']->getSingleIdentifierFieldName()) ); ... ``` If you move the field name (3rd parameter) out of the array, it seems to work: ``` ... $pathExpression = new PathExpression( PathExpression::TYPE*STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED*ASSOCIATION, $parentName, $parent['metadata']->getSingleIdentifierFieldName() ); ... ``` ``` SELECT count(DISTINCT z0_.id) AS sclr0 FROM ... ```
admin added the Bug label 2026-01-22 13:02:51 +01:00
admin closed this issue 2026-01-22 13:02:53 +01:00
Author
Owner

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

Comment created by @beberlei:

Fixed

@doctrinebot commented on GitHub (Dec 12, 2010): Comment created by @beberlei: Fixed
Author
Owner

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

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 12, 2010): 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#1120