DDC-436: Foreign keys on primary keys and vice versa #542

Open
opened 2026-01-22 12:41:57 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 17, 2010).

Jira issue originally created by user romanb:

It was recently brought to our attention that foreign keys on primary keys and vice versa dont seem to work very well yet. This may be related to the problem of "mapping foreign keys to object properties" and also related to composite keys. We should make some tests with a schema similar to the following:

create table company ( id int not null auto_increment, primary key(id));
create table company*sponsorship ( company_id int not null, start_date datetime, primary key(company_id), foreign key company*id references company(id));
Originally created by @doctrinebot on GitHub (Mar 17, 2010). Jira issue originally created by user romanb: It was recently brought to our attention that foreign keys on primary keys and vice versa dont seem to work very well yet. This may be related to the problem of "mapping foreign keys to object properties" and also related to composite keys. We should make some tests with a schema similar to the following: ``` create table company ( id int not null auto_increment, primary key(id)); create table company*sponsorship ( company_id int not null, start_date datetime, primary key(company_id), foreign key company*id references company(id)); ```
admin added the Improvement label 2026-01-22 12:41:57 +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#542