简体   繁体   English

SonataAdmin - 面包屑

[英]SonataAdmin - Breadcrumbs

I'm using SonataAdminBundle and I'm seeing some odd things with the breadcrumbs 我正在使用SonataAdminBundle ,我看到了面包屑的一些奇怪的东西

On some I see Dashboard / User list / Bob when editing a user called Bob 在某些情况下,我在编辑名为Bob的用户时看到Dashboard / User list / Bob Bob

Now when I edit another entity, such as Post for a Post Entity, I see things like the following 现在当我编辑另一个实体时,例如Post for a Post Entity,我看到如下内容

Dashboard / Post list / BM\\AdminBundle\\Entity\\Post:000000002e991893000000000df3fcde

Has anyone seen this before? 谁看过这个吗?

I'm not sure why it is doing this. 我不确定为什么会这样做。

Thanks 谢谢

您必须在各自的实体中定义魔术函数__toString()并将一个属性作为字符串返回。

You have to write the __toString() function in your Entity, for instance : 您必须在实体中编写__toString()函数,例如:

//in BM\AdminBundle\Entity\Post
public function __toString()
{
    if ($this->getId())
        return "Post ".$this->getId();
    return "New Post";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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