DDC-192: Composite primary key workaround stopped working after SchemaTool refactoring #238

Closed
opened 2026-01-22 12:31:58 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 3, 2009).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user nicokaiser:

This example shows a *User* and a Phonenumber entity, where the Phonenumber entity has a phone column and a userId column (which maps the Phonenumber to the User). Primary key should be composite (phone, userId).

http://pastie.org/private/uoawwvf75onnvph8bj1fwg

Normally I would achieve this by adding @Id to the User association in Phonenumber.php, but since @Id is not supported for associations, I added a userId property (which I have to set every time I set the User property).

After the SchemaTool refactoring, Doctrine 2 complains about duplicate keys when trying to create the database...

see DDC-117 (@Id on associations should really be supported and add the "JoinColumn name" to the list of primary keys...)

Originally created by @doctrinebot on GitHub (Dec 3, 2009). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user nicokaiser: This example shows a **User\* and a _Phonenumber_ entity, where the *Phonenumber** entity has a _phone_ column and a _userId_ column (which maps the Phonenumber to the User). Primary key should be composite (phone, userId). http://pastie.org/private/uoawwvf75onnvph8bj1fwg Normally I would achieve this by adding @Id to the User association in Phonenumber.php, but since @Id is not supported for associations, I added a userId property (which I have to set every time I set the User property). After the SchemaTool refactoring, Doctrine 2 complains about duplicate keys when trying to create the database... see [DDC-117](http://www.doctrine-project.org/jira/browse/DDC-117) (@Id on associations should really be supported and add the "JoinColumn name" to the list of primary keys...)
admin added the Bug label 2026-01-22 12:31:58 +01:00
admin closed this issue 2026-01-22 12:31:58 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 6, 2009):

Comment created by @beberlei:

Can you comment on this issue, is it still present?

@doctrinebot commented on GitHub (Dec 6, 2009): Comment created by @beberlei: Can you comment on this issue, is it still present?
Author
Owner

@doctrinebot commented on GitHub (Dec 8, 2009):

Comment created by romanb:

Can this be considered fixed now?

@doctrinebot commented on GitHub (Dec 8, 2009): Comment created by romanb: Can this be considered fixed now?
Author
Owner

@doctrinebot commented on GitHub (Dec 8, 2009):

Comment created by nicokaiser:

Looks good!

@doctrinebot commented on GitHub (Dec 8, 2009): Comment created by nicokaiser: Looks good!
Author
Owner

@doctrinebot commented on GitHub (Dec 8, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 8, 2009): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#238