mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 17:33:15 +02:00
Class inheritance without adding a new field breaks find (wrong SQL generated) #7097
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nunoplopes on GitHub (Jan 25, 2023).
Bug Report
Summary
I have an abstract class with 1 field. An inherited class adds no extra fields.
Doing a repository find of the inherited class generates wrong SQL.
Current behavior
Throws an exception (
Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such column: t0.name in Connection.php:60) due to broken SQL that is generated.The generated SQL is:
The code looks like:
In terms of tables, the table
GitHubRepositoryhas 1 column (name), and tableRepositoryhas no columns.@nunoplopes commented on GitHub (Jan 25, 2023):
Closing. I should be using
@MappedSuperclass, not@Entity.@mpdude commented on GitHub (Jan 26, 2023):
I think that with #10431 (which is in the current
2.15.x-dev), you should have been given a deprecation notice for a missing inheritance declaration, and in 3.0, it would have been a failure.