{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/9588","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/9588/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/9588/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/9588/events","html_url":"https://github.com/yiisoft/yii2/issues/9588","id":104674623,"number":9588,"title":"Return Model with relashions (Restful API)","user":{"login":"sergey-rud","id":11909870,"avatar_url":"https://avatars.githubusercontent.com/u/11909870?v=3","gravatar_id":"","url":"https://api.github.com/users/sergey-rud","html_url":"https://github.com/sergey-rud","followers_url":"https://api.github.com/users/sergey-rud/followers","following_url":"https://api.github.com/users/sergey-rud/following{/other_user}","gists_url":"https://api.github.com/users/sergey-rud/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-rud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-rud/subscriptions","organizations_url":"https://api.github.com/users/sergey-rud/orgs","repos_url":"https://api.github.com/users/sergey-rud/repos","events_url":"https://api.github.com/users/sergey-rud/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-rud/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-03T11:53:35Z","updated_at":"2015-09-04T11:14:06Z","closed_at":"2015-09-04T11:14:06Z","body":"Hi all. I built few API using Yii2 and all works well, but I have one small issue.\r\n\r\nQuest::find()\r\n            ->with(['images', 'route'])\r\n            ->all();\r\n\r\nReturn only Quest object as response, without images and route.\r\n\r\nWe can fix it:\r\nQuest::find()\r\n            ->with(['images', 'route'])\r\n            ->asArray()\r\n            ->all();\r\nThis response will contain quests with images and route. But it's a bad way, because using asArray() we lost some ActiveRecord features (eg, afterFind). \r\n\r\nSo how we can solve this?"}}