问题描述
我在同一个实体上有一个具有 manyToOne 关系的实体
class Post {
/**
* @ORM\OneToMany(targetEntity=Post::class,mappedBy="lotParent")
*/
private $linkedPosts;
}
如何在不序列化子项的所有属性的情况下序列化主帖子的所有帖子属性?
我的 yaml 序列化文件是这样的,但所有属性对孩子都是可见的:
App\Entity\Post:
ExclusionPolicy: ALL
properties:
id:
expose: true
groups: [viewPost,viewChildPost]
title:
expose: true
groups: [viewPost]
......
linkedPosts:
expose: true
groups: [viewChildPost]
我不想要这个例子中的儿童标题。 我可以在序列化组上使用 symfony 表达式吗?我没有看到这样的东西
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)