如何才能访问引用到另一个实体索纳塔的属性


How can I can access a property referred to another entity Sonata?

class Comment
{
    private $foreignId;
    private $foreignType;

在我的CommentAdmin

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper ->add('name', 'string', array('template' => 'AdminBundle:Comment:name.html.twig', 'label' => 'Name'))

那么我如何在没有关系表的情况下访问id = foreignId的实体的name属性呢?我想这样做:

{{ object.foreignEntityId.name }}

不可能!

如果你只有ID而没有对象本身或者我误解了你的问题

奥斯卡·