I have a [font="Courier New"]User[/font] model which includes [font="Courier New"]Profile[/font] which further includes [font="Courier New"]Country[/font].
I have a REST call like this:
GET api/users?expand=profile
Which returns all users with profile as expected. But I also need Country included in my profile. Something like this:
GET api/users?expand=profile,profile.country
But this does not work. Is this supported at all, or are there any other solutions oir such cases?
I’ve also tried overriding [font=“Courier New”]actionIndex[/font] to manually find all records with relations:
public function actionIndex() {
$query = User::find()->with('profile')->all();
return new ActiveDataProvider([
'query' => $query,
]);
}
But this does not even include [font=“Courier New”]Profile[/font]. API JSON response only shows basic users with no profile. I haven’t even tried Country. Any ideas what am I doing wrong?