如何更改 Flash 消息中的实体名称

How to change entity name in flash message

编辑对象后我收到了这条闪现消息

L'élément "P\BOBundle\Entity\Distributeur:0000000037396bc6000000006e8ad34e" a été mis à jour avec succès.

因此我需要更改此消息中的实体名称:P\BOBundle\Entity\Distributeur:0000000037396bc6000000006e8ad34eDistributeur

使用正则表达式怎么样?

类似于:

\(\w+):

http://www.regexr.com/3ef0h

如果有创建该即闪消息的代码就好了。 谢谢。

最好的解决方案是覆盖

__toString

实体 class 中的方法,并使其 return 成为对象的名称。