No identifier / primary key specified for Entity

Why am I getting this exception

Doctrine \ ORM \ Mapping \ MappingException: identifier / primary key for Entity object "Entities \ Category" for class "". Each object must have an identifier / primary key. in /Users/munnik/Sites/doctrine/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php on line 38

for this class:

<?php namespace Entities; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="category") **/ class Category { /** @ORM\Id @ORM\Column(name="id", type="integer") @ORM\GeneratedValue **/ private $id; /** @ORM\Column(name="name", type="string") **/ private $name; } 

I just can not find the problem? @ORM \ Id should indicate $ id as primary key?

+4
source share

Source: https://habr.com/ru/post/1439362/


All Articles