我有3個實體:學說爲了通過相關實體領域
My\Bundle\Entity\Investment:
type: entity
fields:
# ...
oneToMany:
payouts:
targetEntity: My\Bundle\Entity\Payout
mappedBy: investment
orderBy: {operation.effectiveDate: 'ASC'}
My\Bundle\Entity\Payout:
type: entity
fields:
# ...
manyToOne:
investment:
targetEntity: My\Bundle\Entity\Investment
inversedBy: payouts
operation:
targetEntity: My\Bundle\Entity\Operation
inversedBy: payouts
My\Bundle\Entity\Operation:
type: entity
fields:
effectiveDate:
type: datetime
# ...
oneToMany:
payouts:
targetEntity: My\Bundle\Entity\Payout
mappedBy: operation
正如你所看到的,investment
有多個payouts
被連接到一個operation
我想獲得investment.payouts
通過有序payout.operation.effectiveDate
。
我試圖使用orderBy: {operation.effectiveDate: 'ASC'}
,但它不起作用。
所以,問題是:
如何訂購通過payout.operation.effectiveDate
investment.payouts
?
你能告訴我你正在執行的查詢的代碼嗎? –
'$ em-> find('MyBundle:Investment',42) - > getPayouts()' –