B
B
BonBon Slick2018-12-22 23:31:28
Doctrine ORM
BonBon Slick, 2018-12-22 23:31:28

Composite embeddable primary key by 2 fields?

<embedded  name="ip" class="ValueObject\Ip" />
// ERROR
  No identifier/primary key specified for Entity "Entity". Every Entity must have an identifier/primary key.

Only primitive types are allowed here.
https://www.doctrine-project.org/projects/doctrine...
Also, if you name the field id and do embedde, the doctrine automatically makes it an ID, but I want to replace it with another field. Naturally, without auto-increment or something else, we manually set the ID with a check for unique in two fields.
There are ip and like there, that is, the same IP can be for different likes, from under different users, so you need to count the uniqueness in two fields.
How?
And the dock does not cover such cases
https://www.doctrine-project.org/projects/doctrine...
https://www.doctrine-project.org/projects/doctrine...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question