{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8609","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8609/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8609/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8609/events","html_url":"https://github.com/yiisoft/yii2/issues/8609","id":82728887,"number":8609,"title":"indexBy handling of ambiguate columns","user":{"login":"twinni","id":5811414,"avatar_url":"https://avatars.githubusercontent.com/u/5811414?v=3","gravatar_id":"","url":"https://api.github.com/users/twinni","html_url":"https://github.com/twinni","followers_url":"https://api.github.com/users/twinni/followers","following_url":"https://api.github.com/users/twinni/following{/other_user}","gists_url":"https://api.github.com/users/twinni/gists{/gist_id}","starred_url":"https://api.github.com/users/twinni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twinni/subscriptions","organizations_url":"https://api.github.com/users/twinni/orgs","repos_url":"https://api.github.com/users/twinni/repos","events_url":"https://api.github.com/users/twinni/events{/privacy}","received_events_url":"https://api.github.com/users/twinni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-30T06:57:36Z","updated_at":"2015-05-30T10:23:08Z","closed_at":"2015-05-30T10:23:08Z","body":"IndexBy function can't take a column name in form of 'tableName'.'columnName'.\r\nTo make it work I had to select the column and gave this column an alias (The alias can be the same as the column name). \r\nThis works:\r\n```php\r\nreturn self::find()\r\n->select(['adr', self::tableName().'.id as id'])    // select of column 'id' and aliasing is required! \r\n ->indexBy('id')                                          // The value of the selected, aliased column 'id' is taken\r\n->joinwith('adresse')\r\n->orderBy('adr')->column();\r\n```\r\nThis returns wrong results for the 'id' column.\r\n```php\r\nreturn self::find()\r\n->select(['adr'])                                               // What should be possible \r\n->indexBy( self::tableName().'.id')                   //  index starts wiht 0 - it's not the column value!\r\n->joinwith('adresse')\r\n->orderBy('adr')->column();\r\n```"}}