I hava a class City which consists of a number of traits.
/**
* @ORM\Entity
* @ORM\Table(name="City")
* @SoftDeleteable(fieldName="deletedAt")
*/
class City
{
use IdentifiableEntity;
use TimestampableEntity;
}
I have a trait IdentifiableEntity
trait IdentifiableEntity
{
/**
* @var integer
* @ORM\Column(name="id", type="integer", options={"unsigned":true})
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
//setter getter
}
the problem occurs when I execute bin/console doctrine:migrations:diff I get this error message
[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity "AppBundle\Entity\City\City". Every Entity must have an identifier/primary key.
Why is that? I have clearly stated in my trait that $id
should be treated like @ORM\Id
. Adding @ORM\GeneratedValue(strategy="IDENTITY")
does not help either. What's wrong?
P.S. I am using symfony 3.2 and doctrine/doctrine-migrations-bundle: 1.0