mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Single id is not allowed on composite primary key in entity #5451
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 @podorozhny on GitHub (Mar 13, 2017).
Originally assigned to: @Ocramius on GitHub.
I have same issue as described in this question.
Can't use composite keys in entity, while having one of them being auto-generated.
For example:
This will work until I add @GeneratedValue() on one of them.
Thanks.
@Ocramius commented on GitHub (Mar 13, 2017):
Multi-column composite identifiers are not supported, and are going to stay like that for a while, since we didn't figure out how to properly handle them. A custom identifier generator strategy would be preferrable on your side.
Closing as
won't fix@adrienbrault commented on GitHub (Jan 25, 2018):
@Ocramius Could you explain what the issue/limitation is ?
@Ocramius commented on GitHub (Jan 25, 2018):
The problem is that the
UnitOfWorkand many other internal components assume that an identifier is either generated or not: we don't have a concept in between. I know @guilhermeblanco did some work on this for 3.x, but I don't know how far he got.@marquez20 commented on GitHub (Apr 4, 2020):
You need to remove all @Id in properties description except protected $id.
@iamkhusainov7 commented on GitHub (Sep 24, 2023):
There is a disadvantage of it. Like, JoinColumn referencedColumn key must always reference the entity identifier. For instance, I cannot use uuid as a foreign key if uuid is not the primary key.