{"action":"created","issue":{"url":"https://api.github.com/repos/ice/framework/issues/185","repository_url":"https://api.github.com/repos/ice/framework","labels_url":"https://api.github.com/repos/ice/framework/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/ice/framework/issues/185/comments","events_url":"https://api.github.com/repos/ice/framework/issues/185/events","html_url":"https://github.com/ice/framework/pull/185","id":360334273,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1NjE3NDM4","number":185,"title":"Model, enhanced and bug fixed","user":{"login":"Yahasana","id":97450,"node_id":"MDQ6VXNlcjk3NDUw","avatar_url":"https://avatars0.githubusercontent.com/u/97450?v=4","gravatar_id":"","url":"https://api.github.com/users/Yahasana","html_url":"https://github.com/Yahasana","followers_url":"https://api.github.com/users/Yahasana/followers","following_url":"https://api.github.com/users/Yahasana/following{/other_user}","gists_url":"https://api.github.com/users/Yahasana/gists{/gist_id}","starred_url":"https://api.github.com/users/Yahasana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yahasana/subscriptions","organizations_url":"https://api.github.com/users/Yahasana/orgs","repos_url":"https://api.github.com/users/Yahasana/repos","events_url":"https://api.github.com/users/Yahasana/events{/privacy}","received_events_url":"https://api.github.com/users/Yahasana/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-14T14:43:51Z","updated_at":"2018-09-14T15:26:57Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ice/framework/pulls/185","html_url":"https://github.com/ice/framework/pull/185","diff_url":"https://github.com/ice/framework/pull/185.diff","patch_url":"https://github.com/ice/framework/pull/185.patch"},"body":"1) no exception when create model by filters, you can test if it exists in db by `(new iModel(['id' => 9]))->exists()`\r\n2) fixed fineOne initial order: `onConstruct` --> load data from service --> `initialize`. \r\n    the original order is: `onConstruct` --> `initialize` --> load data from service.\r\n3) only reset primary key after insert if the primary key is `autoincrement`\r\n4) minus enhancements\r\n5) disallow empty filters for `loadOne`\r\n6) fixed `getRules('zzz')` will return all rules"},"comment":{"url":"https://api.github.com/repos/ice/framework/issues/comments/421394611","html_url":"https://github.com/ice/framework/pull/185#issuecomment-421394611","issue_url":"https://api.github.com/repos/ice/framework/issues/185","id":421394611,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTM5NDYxMQ==","user":{"login":"mruz","id":2629882,"node_id":"MDQ6VXNlcjI2Mjk4ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/2629882?v=4","gravatar_id":"","url":"https://api.github.com/users/mruz","html_url":"https://github.com/mruz","followers_url":"https://api.github.com/users/mruz/followers","following_url":"https://api.github.com/users/mruz/following{/other_user}","gists_url":"https://api.github.com/users/mruz/gists{/gist_id}","starred_url":"https://api.github.com/users/mruz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mruz/subscriptions","organizations_url":"https://api.github.com/users/mruz/orgs","repos_url":"https://api.github.com/users/mruz/repos","events_url":"https://api.github.com/users/mruz/events{/privacy}","received_events_url":"https://api.github.com/users/mruz/received_events","type":"User","site_admin":false},"created_at":"2018-09-14T15:26:57Z","updated_at":"2018-09-14T15:26:57Z","author_association":"MEMBER","body":"I will add some tests for getting related records too.\r\n```\r\nclass Posts extends Model\r\n{\r\n    public function initialize()\r\n    {\r\n        $this->belongsTo('user_id', __NAMESPACE__ . '\\Users', $this->getIdKey(), ['alias' => 'User']);\r\n        $this->hasMany($this->getIdKey(), __NAMESPACE__ . '\\Coments', 'post_id', ['alias' => 'Coments']);\r\n    }\r\n}\r\n```\r\n\r\n```\r\n$post = Posts::findOne(1);\r\n$user = $post->getUser();\r\n\r\nforeach ($post->getComments(['status' => 1], ['order' => 'id DESC']) as $comment) {\r\n    echo $comment->content;\r\n}\r\n```"}}
{"actor":{"display_login":"mruz"}}