No identifier/primary key specified for Entity with php 8 attributs #6740

Closed
opened 2026-01-22 15:37:50 +01:00 by admin · 1 comment
Owner

Originally created by @TheKassaK on GitHub (Jun 1, 2021).

Hi,

I tried to update an entity with orm php 8 attributes, like :

    #[ORM\Id, ORM\Column(type: "integer")]
    #[ORM\GeneratedValue(strategy: "AUTO")]
    protected ?int $id = null;

But when I doctrine:schema:update I have this error :

No identifier/primary key specified for Entity "App\Entity\XXXXX". Every Entity must have an identifier/primary key.

What is the problem ?

Edit :

In doctrine.yaml, if I switch from type: annotation to type: attribute I have this error :

The service "doctrine.orm.default_attribute_metadata_driver" has a dependen
!! cy on a non-existent parameter "doctrine.orm.metadata.attribute.class". Did
!! you mean one of these: "doctrine.orm.metadata.driver_chain.class", "doctri
!! ne.orm.metadata.annotation.class", "doctrine.orm.metadata.xml.class", "doct
!! rine.orm.metadata.yml.class", "doctrine.orm.metadata.php.class", "doctrine.
!! orm.metadata.staticphp.class", "doctrine.orm.validator.unique.class"?

Originally created by @TheKassaK on GitHub (Jun 1, 2021). Hi, I tried to update an entity with orm php 8 attributes, like : ``` #[ORM\Id, ORM\Column(type: "integer")] #[ORM\GeneratedValue(strategy: "AUTO")] protected ?int $id = null; ``` But when I doctrine:schema:update I have this error : **No identifier/primary key specified for Entity "App\Entity\XXXXX". Every Entity must have an identifier/primary key.** What is the problem ? Edit : In doctrine.yaml, if I switch from type: annotation to type: attribute I have this error : **The service "doctrine.orm.default_attribute_metadata_driver" has a dependen !! cy on a non-existent parameter "doctrine.orm.metadata.attribute.class". Did !! you mean one of these: "doctrine.orm.metadata.driver_chain.class", "doctri !! ne.orm.metadata.annotation.class", "doctrine.orm.metadata.xml.class", "doct !! rine.orm.metadata.yml.class", "doctrine.orm.metadata.php.class", "doctrine. !! orm.metadata.staticphp.class", "doctrine.orm.validator.unique.class"?**
admin closed this issue 2026-01-22 15:37:50 +01:00
Author
Owner

@beberlei commented on GitHub (Jun 2, 2021):

It seems that you do not have DoctrineBundle version 2.4-dev installed? Thats currently required for type: attribute to work.

@beberlei commented on GitHub (Jun 2, 2021): It seems that you do not have DoctrineBundle version 2.4-dev installed? Thats currently required for `type: attribute` to work.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6740