[英]How can I can access a property referred to another entity Sonata?
class Comment
{
private $foreignId;
private $foreignType;
And in my CommentAdmin 在我的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. 因此,如何在没有关系表的情况下访问其id = foreignId的实体的name属性。 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 如果您只有ID而没有对象本身,或者我误会了您的问题
Oskar 奥斯卡
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.