反射异常:属性$id不存在


ReflectionException: Property $id does not exist

我已经更改了实体的主键,但现在我得到了这个错误:

ReflectionException Property DnD''ApiBundle''Entity''Agent::$id does not exist

我的实体是这样的:

<?php
namespace DnD'ApiBundle'Entity;
use Doctrine'ORM'Mapping as ORM;
use JMS'Serializer'Annotation'Groups;
use Doctrine'ORM'Mapping'Id;
use Doctrine'ORM'Mapping'Column;
/**
 * Agent
 *
 * @ORM'Table()
 * @ORM'Entity(repositoryClass="DnD'ApiBundle'Repository'AgentRepository")
 */
class Agent
{
  /**
   * @var string
   *
   * @Groups({"list", "details"})
   * @Id
   * @Column(type="string", length=255)
   */
  private $agentId;
  ...

我已经清除了教义缓存,但错误仍然存在。为什么会这样。

谢谢!

通过

应用程序/控制台清除缓存是不够的,完全删除缓存文件夹,它对我有用