我试图在Symfony2中的基本Entity类上使用Doctrine2为一个数据库创建一个抽象的getId方法,在该数据库中,主键在表间不一致地命名.
在检查实体对象时,我看到有一个私有的'_identifier'属性,其中包含我尝试检索的信息,但我不确定如何正确访问它.
我假设有一些简单的Doctrine魔法类似于:
public function getId()
{
return $this->getIdentifier();
}
Run Code Online (Sandbox Code Playgroud)
但我没有设法在任何地方的intertubes上找到它.