我有以下实体:
用户 1:n StatementResponse n:1 声明 n:1 调查 1:n 用户
正如你所看到的,entites之间的关系是围成一圈的。我需要使用给定用户的响应来查询调查的所有陈述。不是每个声明都必须得到回答。结果应该是一个关联数组,如下所示:
[
1 => [
'statement' => Statement Entity with id 1
'response' => 'Response Entity from the given user of Statement with id 1
],
2 => [
'statement' => Statement Entity with id 2
'response' => null
],
3 => [
'statement' => Statement Entity with id 3
'response' => Response Entity from the given user of Statement with id 3
]
]
是否可以在自定义存储库中获得这样的结果?