Skip to content

Fix duplicate foreign key deprecation with Single Table Inheritance#12391

Open
janedbal wants to merge 2 commits into
doctrine:3.6.xfrom
janedbal:fix/sti-duplicate-foreign-key-deprecation
Open

Fix duplicate foreign key deprecation with Single Table Inheritance#12391
janedbal wants to merge 2 commits into
doctrine:3.6.xfrom
janedbal:fix/sti-duplicate-foreign-key-deprecation

Conversation

@janedbal

Copy link
Copy Markdown
Contributor

When multiple STI child entities have a ManyToOne relation to the same target entity using the same join column, SchemaTool called addForeignKeyConstraint twice with the same constraint name, triggering a DBAL deprecation ("Overwriting an existing foreign key constraint").

The fix skips the redundant addForeignKeyConstraint call when an identical FK (same local columns, same foreign table, same foreign columns) was already added.

See doctrine/dbal#7125

@janedbal

Copy link
Copy Markdown
Contributor Author

Any chance somebody looks into this one?

@greg0ire

Copy link
Copy Markdown
Member

It seems there are CI jobs failing. Please take a look at this guide for more on how to handle those.

When multiple STI child entities have a ManyToOne relation to the same
target entity using the same join column, SchemaTool called
addForeignKeyConstraint twice with the same constraint name, triggering
a DBAL deprecation ("Overwriting an existing foreign key constraint").

The fix skips the redundant addForeignKeyConstraint call when an
identical FK (same local columns, same foreign table, same foreign
columns) was already added.

See doctrine/dbal#7125
@janedbal janedbal force-pushed the fix/sti-duplicate-foreign-key-deprecation branch from f750132 to 9a912d2 Compare April 22, 2026 07:00
@janedbal

Copy link
Copy Markdown
Contributor Author

@greg0ire None of those were related to our changes. I just rebased to trigger new pipeline.

@greg0ire

Copy link
Copy Markdown
Member

That's cool. Bear in mind that I will always prioritize reviewing PRs with a green build.

Comment thread tests/Tests/ORM/Tools/SchemaToolTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants