Ziggi
(Ziggi)
1
Hi,
Using ?expand=relationName I can enfroce a RESTfull api view to contain related model data.
But how to ensure related models of this related model to be nested in the second trier?
I need:
USER -> ORDERS -> ORDER’s ITEMS
in a single (nested) view!
Thanks ahead of your kind feedback!
nadario
(Basil)
2
I am sure you can use expand=relationName.subRelation
but i am not sure if you have to preload the given relation with with()
.
for example:
return new ActiveDataProvider([
'query' => User::find()->with(['orders.orderItems']),
]);
So you might try also just ['orders']
without the sub relation.
1 Like
Ziggi
(Ziggi)
3
Sweet - thank you so much !!!