[PR #11200] Ignore subclasses without discriminatorValue when generating discriminator column condition SQL #12849

Closed
opened 2026-01-22 16:15:23 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/11200

State: closed
Merged: Yes


After commit 4e8e3ef30b when \Doctrine\ORM\Query\SqlWalker generates dicsriminator column condition SQL (method \Doctrine\ORM\Query\SqlWalker::generateDiscriminatorColumnConditionSQL) it adds an empty string to the list of possible values if the inheritance hierarchy contains a non-root abstract class.

When the discriminator column is implemented with a custom type in PostgreSQL (equivalent of Enum) the query fails because the type cannot have a value of an empty string. It boils down to the fact that \Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses contains an abstract class and in its Metadata the value of \Doctrine\ORM\Mapping\ClassMetadataInfo::$discriminatorValue is null.

Previous behavior

In version 2.14.1 \Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses does not contain an abstract class.

Fixes #11199, fixes #11177, fixes #10846.

**Original Pull Request:** https://github.com/doctrine/orm/pull/11200 **State:** closed **Merged:** Yes --- After commit https://github.com/doctrine/orm/commit/4e8e3ef30b3d214640883aec5a17896afc006116 when `\Doctrine\ORM\Query\SqlWalker` generates dicsriminator column condition SQL (method `\Doctrine\ORM\Query\SqlWalker::generateDiscriminatorColumnConditionSQL`) it adds an empty string to the list of possible values if the inheritance hierarchy contains a non-root abstract class. When the discriminator column is implemented with a custom type in PostgreSQL (equivalent of Enum) the query fails because the type cannot have a value of an empty string. It boils down to the fact that `\Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses` contains an abstract class and in its Metadata the value of `\Doctrine\ORM\Mapping\ClassMetadataInfo::$discriminatorValue` is `null`. #### Previous behavior In version 2.14.1 `\Doctrine\ORM\Mapping\ClassMetadataInfo::$subClasses` does not contain an abstract class. Fixes #11199, fixes #11177, fixes #10846.
admin added the pull-request label 2026-01-22 16:15:23 +01:00
admin closed this issue 2026-01-22 16:15:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12849