【发布时间】:2014-03-06 12:34:41
【问题描述】:
我使用此代码获取实体名称;
function setTypeFunction($data)
{
$em = $this->container->get('doctrine')->getManager();
$type = $em->getClassMetadata(get_class($data))->getName();
return $type;
}
但是,这个功能没有给我我想要的。这个返回;
Acme/DemoBundle/Entity/User
但是,我只想要实体名称;所以“用户”。
我该怎么办?我不想使用 strstrip 等功能。
【问题讨论】:
标签: php symfony namespaces entity