No alias gathered from createSqlForFinalizer() #7457

Open
opened 2026-01-22 15:51:52 +01:00 by admin · 0 comments
Owner

Originally created by @Bypus on GitHub (Jan 3, 2025).

Bug Report

Q A
Version ^3.3
Previous Version if the bug is a regression ---

Summary

SQLIdentifier is empty

Current behavior

When trying to gather the list of users with FOSUserBundle and SonataUser, $sqlIdentifier is empty, resulting in a query with nothing after DISTINCT:
SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT FROM (SELECT

Expected behavior

Expected a list of aliases after DISTINCT

How to reproduce

Check for list of users from SonataAdminBundle interface

Here are the informations I gathered:
In CountOutputWalker:
$fromRoot:

 [Doctrine\ORM\Query\AST\IdentificationVariableDeclaration](file:///E:/Users/Joris/Documents/tope-la_2024_2/vendor/doctrine/orm/src/Query/AST/IdentificationVariableDeclaration.php#L14) {#1844 ▼
  +rangeVariableDeclaration: 
Doctrine\ORM\Query\AST
\
RangeVariableDeclaration {#1843 ▼
    +abstractSchemaName: "Sonata\UserBundle\Entity\BaseUser"
    +aliasIdentificationVariable: "o"
    +isRoot: true
  }
  +indexBy: null
  +joins: []
}

$rootAlias:

"o"

$rootClass:

[Doctrine\ORM\Mapping\ClassMetadata](file:///E:/Users/Joris/Documents/tope-la_2024_2/vendor/doctrine/orm/src/Mapping/ClassMetadata.php#L78) {#1387 ▼
  +namespace: "Sonata\UserBundle\Entity"
  +rootEntityName: "Sonata\UserBundle\Entity\BaseUser"
  +customGeneratorDefinition: null
  +customRepositoryClassName: null
  +isMappedSuperclass: true
  +isEmbeddedClass: false
  +parentClasses: []
  +subClasses: []
  +embeddedClasses: []
  +identifier: []
  +inheritanceType: 1
  +generatorType: 5
  +fieldMappings: array:13 [▶]
  +fieldNames: array:13 [▶]
  +columnNames: array:13 [▶]
  +discriminatorValue: null
  +discriminatorMap: []
  +discriminatorColumn: null
  +table: array:1 [▶]
  +lifecycleCallbacks: array:2 [▶]
  +entityListeners: []
  +associationMappings: []
  +isIdentifierComposite: false
  +containsForeignIdentifier: false
  +containsEnumIdentifier: false
  +idGenerator: 
Doctrine\ORM\Id
\
AssignedGenerator {#1337}
  +sequenceGeneratorDefinition: null
  +changeTrackingPolicy: 1
  +requiresFetchAfterChange: false
  +isVersioned: false
  +versionField: null
  +cache: null
  +reflClass: ReflectionClass {#1373 ▶}
  +isReadOnly: false
  #namingStrategy: 
Doctrine\ORM\Mapping
\
UnderscoreNamingStrategy {#721 ▶}
  +reflFields: array:13 [▶]
  -instantiator: 
Doctrine\Instantiator
\
Instantiator {#1394}
  -typedFieldMapper: 
Doctrine\ORM\Mapping
\
DefaultTypedFieldMapper {#730 ▶}
  +name: "Sonata\UserBundle\Entity\BaseUser"
}

This is my composer.json:

    "require": {
        "php": "^8.3",
        "ext-ctype": "*",
        "ext-curl": "*",
        "ext-dom": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "beberlei/doctrineextensions": "^1.5",
        "creof/doctrine2-spatial": ">=1.2",
        "doctrine/dbal": "^3.9.3",
        "doctrine/doctrine-bundle": "^2.13.1",
        "doctrine/doctrine-migrations-bundle": "^3.3.1",
        "doctrine/orm": "^3.3.1",
        "egulias/email-validator": "^4.0.3",
        "friendsofsymfony/ckeditor-bundle": ">=2.5",
        "friendsofsymfony/user-bundle": "^4.0",
        "gedmo/doctrine-extensions": "^3.17.1",
        "guzzlehttp/guzzle": "^7.9.2",
        "incenteev/composer-parameter-handler": "^2.2",
        "phpdocumentor/reflection-docblock": "^5.6.1",
        "phpstan/phpdoc-parser": "^2.0",
        "sonata-project/admin-bundle": "^4.34",
        "sonata-project/block-bundle": ">=5.1.1",
        "sonata-project/doctrine-orm-admin-bundle": "^4.17.1",
        "sonata-project/form-extensions": "^2.4",
        "sonata-project/formatter-bundle": ">=5.4.1",
        "sonata-project/media-bundle": "^4.15",
        "sonata-project/user-bundle": ">=5.14",
        "stof/doctrine-extensions-bundle": "^1.12",
        "symfony/symfony":"^7.2",
        "symfony/monolog-bundle": "^3.10",
        "symfonycasts/reset-password-bundle": "^1.23.1",
        "twig/extra-bundle": "^2.12|^3.18",
        "twig/intl-extra": ">=3.18",
        "twig/twig": "^2.12|^3.18.0",
        "vich/uploader-bundle": ">=2.5"
    },
Originally created by @Bypus on GitHub (Jan 3, 2025). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |-------------------------------------------- | ------ | Version | ^3.3 | Previous Version if the bug is a regression | --- #### Summary SQLIdentifier is empty #### Current behavior When trying to gather the list of users with FOSUserBundle and SonataUser, $sqlIdentifier is empty, resulting in a query with nothing after DISTINCT: `SELECT COUNT(*) AS dctrn_count FROM (SELECT DISTINCT FROM (SELECT` #### Expected behavior Expected a list of aliases after DISTINCT #### How to reproduce Check for list of users from SonataAdminBundle interface Here are the informations I gathered: In CountOutputWalker: $fromRoot: ``` [Doctrine\ORM\Query\AST\IdentificationVariableDeclaration](file:///E:/Users/Joris/Documents/tope-la_2024_2/vendor/doctrine/orm/src/Query/AST/IdentificationVariableDeclaration.php#L14) {#1844 ▼ +rangeVariableDeclaration: Doctrine\ORM\Query\AST \ RangeVariableDeclaration {#1843 ▼ +abstractSchemaName: "Sonata\UserBundle\Entity\BaseUser" +aliasIdentificationVariable: "o" +isRoot: true } +indexBy: null +joins: [] } ``` $rootAlias: ``` "o" ``` $rootClass: ``` [Doctrine\ORM\Mapping\ClassMetadata](file:///E:/Users/Joris/Documents/tope-la_2024_2/vendor/doctrine/orm/src/Mapping/ClassMetadata.php#L78) {#1387 ▼ +namespace: "Sonata\UserBundle\Entity" +rootEntityName: "Sonata\UserBundle\Entity\BaseUser" +customGeneratorDefinition: null +customRepositoryClassName: null +isMappedSuperclass: true +isEmbeddedClass: false +parentClasses: [] +subClasses: [] +embeddedClasses: [] +identifier: [] +inheritanceType: 1 +generatorType: 5 +fieldMappings: array:13 [▶] +fieldNames: array:13 [▶] +columnNames: array:13 [▶] +discriminatorValue: null +discriminatorMap: [] +discriminatorColumn: null +table: array:1 [▶] +lifecycleCallbacks: array:2 [▶] +entityListeners: [] +associationMappings: [] +isIdentifierComposite: false +containsForeignIdentifier: false +containsEnumIdentifier: false +idGenerator: Doctrine\ORM\Id \ AssignedGenerator {#1337} +sequenceGeneratorDefinition: null +changeTrackingPolicy: 1 +requiresFetchAfterChange: false +isVersioned: false +versionField: null +cache: null +reflClass: ReflectionClass {#1373 ▶} +isReadOnly: false #namingStrategy: Doctrine\ORM\Mapping \ UnderscoreNamingStrategy {#721 ▶} +reflFields: array:13 [▶] -instantiator: Doctrine\Instantiator \ Instantiator {#1394} -typedFieldMapper: Doctrine\ORM\Mapping \ DefaultTypedFieldMapper {#730 ▶} +name: "Sonata\UserBundle\Entity\BaseUser" } ``` This is my composer.json: ```json "require": { "php": "^8.3", "ext-ctype": "*", "ext-curl": "*", "ext-dom": "*", "ext-iconv": "*", "ext-intl": "*", "beberlei/doctrineextensions": "^1.5", "creof/doctrine2-spatial": ">=1.2", "doctrine/dbal": "^3.9.3", "doctrine/doctrine-bundle": "^2.13.1", "doctrine/doctrine-migrations-bundle": "^3.3.1", "doctrine/orm": "^3.3.1", "egulias/email-validator": "^4.0.3", "friendsofsymfony/ckeditor-bundle": ">=2.5", "friendsofsymfony/user-bundle": "^4.0", "gedmo/doctrine-extensions": "^3.17.1", "guzzlehttp/guzzle": "^7.9.2", "incenteev/composer-parameter-handler": "^2.2", "phpdocumentor/reflection-docblock": "^5.6.1", "phpstan/phpdoc-parser": "^2.0", "sonata-project/admin-bundle": "^4.34", "sonata-project/block-bundle": ">=5.1.1", "sonata-project/doctrine-orm-admin-bundle": "^4.17.1", "sonata-project/form-extensions": "^2.4", "sonata-project/formatter-bundle": ">=5.4.1", "sonata-project/media-bundle": "^4.15", "sonata-project/user-bundle": ">=5.14", "stof/doctrine-extensions-bundle": "^1.12", "symfony/symfony":"^7.2", "symfony/monolog-bundle": "^3.10", "symfonycasts/reset-password-bundle": "^1.23.1", "twig/extra-bundle": "^2.12|^3.18", "twig/intl-extra": ">=3.18", "twig/twig": "^2.12|^3.18.0", "vich/uploader-bundle": ">=2.5" }, ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7457