Search code examples
doctrine

Doctrine - Table without primary keys


I use doctrine. It's possible to generate entities who based on a database with table (important) without primary key ? The DB is for Chacal XXI (an application) and 1 or 2 tables have not primary keys, i can't add primary key manually.


Solution

  • No. From https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/basic-mapping.html#identifiers-primary-keys :

    Every entity class must have an identifier/primary key. You can select the field that serves as the identifier with the @Id annotation.