-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discriminator column empty value "IN" query #10846
Comments
This error comes from It is most likely caused by #10411. Similar issue already fixed: #10643 It also emits to following error:
|
Please report in #11200 whether it fixes this issue |
I have installed the patched on my tested project I have tested it on my playground and I confirm that the patch will fix the issue with IN statement. Some testing on real application could be done by my colleague @RalkeryBug "repositories": [{
"type": "vcs",
"url": "https://github.com/DemoniacDeath/orm.git"
}
], Install the patch version composer require doctrine/orm:dev-issue-11199 -W Run the application test to make sure patch does not break anything else. |
…nator column condition SQL (#11200) After commit 4e8e3ef 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. --------- Co-authored-by: Michael Skvortsov <michael.skvortsov@eleving.com> Co-authored-by: Matthias Pigulla <mp@webfactory.de>
Fixed by #11200 |
Bug Report
Summary
DiscriminatorMap adding empty value (
''
) to SQL query example:This leads to error
invalid input value
when using Enum for Postgres DBCurrent behavior
Adding
o0_.type IN ('blockchain-in', 'expense', '')
is incorrect and should beo0_.type IN ('blockchain-in', 'expense')
How to reproduce
I create a repository with an easy way to reproduce this issue.
It was introduced in version
2.14.2
prior to this version it was working as expected.You could verify it by cloning the repository: https://github.com/Legion112/doctrine-playground
After cloning use docker for quick setup:
After running the command below in logs you could see a wrong select statement
I have confirmed that this version correctly was formatted correctly
Expected behavior
The text was updated successfully, but these errors were encountered: