SilverStripe无法填充多个成员子女
我有3种用户 推销员=>有很多买家 买家=>有很多代理 代理人没有孩子
,所以我想在查看推销员时列出所有与该推销员交往的买家 所有代理商以
class MemberExtension extends DataExtension
{
private static $has_one = [
'RefSalesman' => Member::class,
'AgentOwner' => Member::class,
];
private static $has_many = [
'Buyers' => Member::class,
'Agents' => Member::class,
];
private static $summary_fields = [
'RefSalesman.Name' => 'Ref Salesman',
'AgentOwner.Name' => 'Agent Owner',
];
这种方式查看买家时,我只能看到买家下市的代理商,但在查看推销员时没有买家。
I have 3 type of users
salesman => has many buyers
buyer => has many agents
agent has none child
so I want to list all the buyers associate with that salesman when viewing salesman
and all the agents when viewing buyer in admin
class MemberExtension extends DataExtension
{
private static $has_one = [
'RefSalesman' => Member::class,
'AgentOwner' => Member::class,
];
private static $has_many = [
'Buyers' => Member::class,
'Agents' => Member::class,
];
private static $summary_fields = [
'RefSalesman.Name' => 'Ref Salesman',
'AgentOwner.Name' => 'Agent Owner',
];
This way I am only able to see agents listing under buyers but no buyers when viewing salesman.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些许多人的关系不知道他们指的是哪一个。作为同一类,您必须明确指定点表示的目标关系:有关详细信息,请参见Has-Many文档。
These has-many relations do not know to which has-one they are referring to. Being both the same class, you must explicitely specify the destination relation in dot notation: see the has-many documentation for details.