fredmontet
fredmontet

Reputation: 13

CRUD generation with composite key on Doctrine 2.2

I got a problem with the CRUD generation on Doctrine. I saw that the composite keys have been implemented since version 2.1. I got a few tables that are identified with such keys but when I try to generate the code with the command php app/console generate:doctrine:crud it send me back the following error: "The CRUD generator does not support entity classes with multiple primary keys." Should I code my CRUD from scratch or is there a workaround to generate them?

Upvotes: 1

Views: 1371

Answers (1)

Maxim
Maxim

Reputation: 3946

Doctrine doesnt support composite keys, you could just use a new primary key:

/**

 * @ORM\Id
 * @ORM\Column(name="id", type="integer")
 * @ORM\GeneratedValue
 */
private $id;

Upvotes: 1

Related Questions