Fields order in composite primary key #10761
Unanswered
heahoh
asked this question in
Support Questions
Replies: 1 comment
-
I don't really see why it's unexpected that ID fields are taken into account in the very order that you define them in. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Got an unexpected behavior (not documented as i see) when creating composite primary key
I has two entity with OneToMany relation - order and order.item
Both entity has external identity - order has unique digital number, item - non-unique SKU (but in order context it's unique)
`
Order
@id
private int externalId
@onetomany
private Collection items
`
`
Item
@id
private string sku
@id
private Order order
`
For selectivity reasons I want to create primary_key like (order_id, sku) but
doctrine:schema:update --dump-sql
creates this one -primary_key(sku, order_id)
If I swap lines of
order
andsku
fields declaration to this`
Item
@id
private Order order
@id
private string sku
`
Than I get expected declaration of primary_key
Seems like sort of UB
Codestyle fixes can leads to changing table primary key and behavior not documented in documentation
Beta Was this translation helpful? Give feedback.
All reactions