No identifier/primary key specified for Entity (...) Every Entity must have and identifier/primary key No identifier/primary key specified for Entity (...) Every Entity must have and identifier/primary key symfony symfony

No identifier/primary key specified for Entity (...) Every Entity must have and identifier/primary key


You need to specify id field and remove other @ORM\Id annotations. Identifiers / Primary Keys at doctrine documentation.

Every entity class needs an identifier/primary key. You designate the field that serves as the identifier with the @Id marker annotation.

/** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */protected $id;


The solution is to add the id field to the EntityName.orm.yml id: trueFor example:

AppBundle \ Entity \ Supplier:   type: entity   table: sylius_supplier   fields:     id:       type: integer       id: true       generator:         strategy: AUTO     name: .......


In my case, what happened was this:

I create the entity file, and put it in the entity directory, with the database schema.

But here is the thing, I also created created a YML file for the entity and put it inside Resources/config/doctrine, without a schema. Symfony was looking for the schema inside YML. Once I removed the YML file, the schema in my entity file worked just fine.