{"action":"opened","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/7268","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/7268/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/7268/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/7268/events","html_url":"https://github.com/yiisoft/yii2/issues/7268","id":57599506,"number":7268,"title":"Make \\yii\\db\\Query::all(), one() etc. hookable by EVENT_ROWS_POST_PROCESS","user":{"login":"mcd-php","id":3469206,"avatar_url":"https://avatars.githubusercontent.com/u/3469206?v=3","gravatar_id":"","url":"https://api.github.com/users/mcd-php","html_url":"https://github.com/mcd-php","followers_url":"https://api.github.com/users/mcd-php/followers","following_url":"https://api.github.com/users/mcd-php/following{/other_user}","gists_url":"https://api.github.com/users/mcd-php/gists{/gist_id}","starred_url":"https://api.github.com/users/mcd-php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcd-php/subscriptions","organizations_url":"https://api.github.com/users/mcd-php/orgs","repos_url":"https://api.github.com/users/mcd-php/repos","events_url":"https://api.github.com/users/mcd-php/events{/privacy}","received_events_url":"https://api.github.com/users/mcd-php/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-13T13:39:18Z","updated_at":"2015-02-13T13:39:18Z","closed_at":null,"body":"Example:\r\n\r\n```php\r\ntrait QueryPostProcessTrait {\r\n    public function postProcessRows($rows) {\r\n        $e = new Event();\r\n        $e->data = $rows;\r\n        $this->trigger('EVENT_ROWS_POST_PROCESS',$e);\r\n        return $e->data;\r\n    }\r\n\r\n    public function all( $db = null ) {\r\n        $rows = parent::all($db);\r\n        return $this->postProcessRows($rows);\r\n    }\r\n\r\n    public function one( $db = null ) {\r\n        $rows = [parent::one($db)];\r\n        return $this->postProcessRows($rows)[0];\r\n    }\r\n}\r\n```\r\n\r\nI now have _two_ uses for this, group/order (https://github.com/yiisoft/yii2/issues/7187) and calling `toArrayRecursive()` (https://github.com/yiisoft/yii2/issues/7179) on result, be it array or object. So it grew worth separating in it's own trait ;)\r\n\r\nI believe this will beneficial for user-programmers in many ways !"}}