DDC-689: Composite primary key does not work with @OneToOne #847

Closed
opened 2026-01-22 12:52:32 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 13, 2010).

Jira issue originally created by user jasper:

A composite primary key does not seem to be working with @OneToOne. Example:

class Test {

    /****
     * @Column( type = "integer" )
     * @Id
     */
    private $id;

    /****
     * @Id
     * @OneToOne( targetEntity = "..." )
     */
    private $id2;
}

This example only makes $id the primary key, not a composit key of ($id, $id2).

Originally created by @doctrinebot on GitHub (Jul 13, 2010). Jira issue originally created by user jasper: A composite primary key does not seem to be working with @OneToOne. Example: ``` class Test { /**** * @Column( type = "integer" ) * @Id */ private $id; /**** * @Id * @OneToOne( targetEntity = "..." ) */ private $id2; } ``` This example only makes $id the primary key, not a composit key of ($id, $id2).
admin added the Bug label 2026-01-22 12:52:32 +01:00
admin closed this issue 2026-01-22 12:52:33 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 13, 2010):

Comment created by romanb:

Duplicate of DDC-117.

@doctrinebot commented on GitHub (Jul 13, 2010): Comment created by romanb: Duplicate of [DDC-117](http://www.doctrine-project.org/jira/browse/DDC-117).
Author
Owner

@doctrinebot commented on GitHub (Jul 13, 2010):

Issue was closed with resolution "Duplicate"

@doctrinebot commented on GitHub (Jul 13, 2010): Issue was closed with resolution "Duplicate"
Author
Owner

@doctrinebot commented on GitHub (Jul 13, 2010):

Comment created by romanb:

Note: @OneToOne (or any association annotation) on an id/foreign key field makes no sense at all. @OneToOne/@OneToMany/@ManyToOne/@ManyToMany are for object associations, not foreign keys.

@doctrinebot commented on GitHub (Jul 13, 2010): Comment created by romanb: Note: @OneToOne (or any association annotation) on an **id/foreign key field** makes no sense at all. @OneToOne/@OneToMany/@ManyToOne/@ManyToMany are for object associations, not foreign keys.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#847