{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8316","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8316/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8316/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8316/events","html_url":"https://github.com/yiisoft/yii2/issues/8316","id":73974124,"number":8316,"title":"Support for virtual fields in AR","user":{"login":"SamMousa","id":547021,"avatar_url":"https://avatars.githubusercontent.com/u/547021?v=3","gravatar_id":"","url":"https://api.github.com/users/SamMousa","html_url":"https://github.com/SamMousa","followers_url":"https://api.github.com/users/SamMousa/followers","following_url":"https://api.github.com/users/SamMousa/following{/other_user}","gists_url":"https://api.github.com/users/SamMousa/gists{/gist_id}","starred_url":"https://api.github.com/users/SamMousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamMousa/subscriptions","organizations_url":"https://api.github.com/users/SamMousa/orgs","repos_url":"https://api.github.com/users/SamMousa/repos","events_url":"https://api.github.com/users/SamMousa/events{/privacy}","received_events_url":"https://api.github.com/users/SamMousa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:under%20discussion","name":"status:under discussion","color":"f7c6c7"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:enhancement","name":"type:enhancement","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/9","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.x","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/9/labels","id":831720,"number":9,"title":"2.0.x","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":367,"closed_issues":0,"state":"open","created_at":"2014-10-19T13:49:45Z","updated_at":"2015-07-02T13:04:31Z","due_on":null,"closed_at":null},"comments":27,"created_at":"2015-05-07T12:44:09Z","updated_at":"2015-07-03T04:35:09Z","closed_at":null,"body":"Has the Yii team ever considered implementing support for virtual fields in AR?\r\n\r\nCakePHP has it here: http://book.cakephp.org/2.0/en/models/virtual-fields.html\r\n\r\nWe have implemented it for Yii2 here: https://github.com/MarketFlow/yii2-virtual-fields \r\n(Documentation is there, the actual files will follow in a few mins / hours).\r\n\r\nAdvantage built-in of virtual field support over implementing stuff like \"getPostCount()\" in each model is that virtual fields can be greedily loaded, greatly reducing the number of queries required.\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/118228888","html_url":"https://github.com/yiisoft/yii2/issues/8316#issuecomment-118228888","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/8316","id":118228888,"user":{"login":"SamMousa","id":547021,"avatar_url":"https://avatars.githubusercontent.com/u/547021?v=3","gravatar_id":"","url":"https://api.github.com/users/SamMousa","html_url":"https://github.com/SamMousa","followers_url":"https://api.github.com/users/SamMousa/followers","following_url":"https://api.github.com/users/SamMousa/following{/other_user}","gists_url":"https://api.github.com/users/SamMousa/gists{/gist_id}","starred_url":"https://api.github.com/users/SamMousa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamMousa/subscriptions","organizations_url":"https://api.github.com/users/SamMousa/orgs","repos_url":"https://api.github.com/users/SamMousa/repos","events_url":"https://api.github.com/users/SamMousa/events{/privacy}","received_events_url":"https://api.github.com/users/SamMousa/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T04:35:09Z","updated_at":"2015-07-03T04:35:09Z","body":"@faryshta there is no need for joins. Joins will actually give you a lot if head aches and functionality is limited.\r\n\r\nYour implementation will not work for multiple virtual fields for example (since you can't have multiple independent group by)"}}