简体   繁体   中英

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

class Comment
{
    private $foreignId;
    private $foreignType;

And in my CommentAdmin

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

so how can I access the name property of the entity whose id = foreignId without relations tables. I would like to do something like that:

{{ object.foreignEntityId.name }}

not possible!

If you only have the ID and NOT the object itself or i missunderstand your problem

Oskar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM