【发布时间】:2020-01-06 18:03:14
【问题描述】:
我正在使用教义Class Table Inheritance 处理实体继承。
我有一个基础实体 BaseEntity。
然后我有 FirstEntity 和 SecondEntity 扩展了 BaseEntity。
另一方面,我有一个 StandardEntity,它有一个名为 baseEntities 的 OneToMany BaseEntity 映射关联。
在 StandardEntity 的视图页面中,还应显示与此相关的 BaseEntity 列表。
但我遇到了一些麻烦。
第一个错误:
An exception has been thrown during the rendering of a template ("Warning: nl2br() expects parameter 1 to be string, object given").
第一种解决方案:我将属性的类型强制为关联。
- { property: baseEntities, type: association }
我遇到了第二个错误:
An exception has been thrown during the rendering of a template ("Notice: Undefined index: targetEntity").
但如果我将类型设置为 array,我会得到正确的项目列表,但只有简单的文本。我想要链接到相关实体的链接 - FirstEntity 或 SecondEntity - 查看页面。
- { property: baseEntities, type: array }
【问题讨论】:
标签: doctrine-orm symfony4 symfony2-easyadmin easyadmin