{"action":"closed","number":12816,"pull_request":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/12816","id":90563278,"html_url":"https://github.com/yiisoft/yii2/pull/12816","diff_url":"https://github.com/yiisoft/yii2/pull/12816.diff","patch_url":"https://github.com/yiisoft/yii2/pull/12816.patch","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/12816","number":12816,"state":"closed","locked":false,"title":"custom db column schema","user":{"login":"nanodesu88","id":13536462,"avatar_url":"https://avatars.githubusercontent.com/u/13536462?v=3","gravatar_id":"","url":"https://api.github.com/users/nanodesu88","html_url":"https://github.com/nanodesu88","followers_url":"https://api.github.com/users/nanodesu88/followers","following_url":"https://api.github.com/users/nanodesu88/following{/other_user}","gists_url":"https://api.github.com/users/nanodesu88/gists{/gist_id}","starred_url":"https://api.github.com/users/nanodesu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanodesu88/subscriptions","organizations_url":"https://api.github.com/users/nanodesu88/orgs","repos_url":"https://api.github.com/users/nanodesu88/repos","events_url":"https://api.github.com/users/nanodesu88/events{/privacy}","received_events_url":"https://api.github.com/users/nanodesu88/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Is bugfix?    | no\r\n| New feature?  | yes\r\n| Breaks BC?    | no\r\n| Tests pass?   | yes\r\n\r\nWhat about CustomColumnSchema? Primary for db typecasting.\r\n\r\nAllows to do something like this:\r\n\r\nRecord.php\r\n```php\r\npublic function behaviors()\r\n{\r\n    return [\r\n        'class' => \\yii\\behaviors\\AttributeTypecastBehavior::class,\r\n        'attributeTypes' => [\r\n            'datetime' => function($value){\r\n                if(!$value instanceof \\DateTime){\r\n                    $value = \\DateTime::createFromFormat(?, $value);\r\n                }\r\n\r\n                return $value;\r\n            }\r\n        ],\r\n        'typecastAfterFind' => true,\r\n        'typecastAfterValidate' => false\r\n    ];\r\n}\r\n```\r\n\r\nCustomColumnSchema.php\r\n```php\r\nclass ColumnSchema extends \\yii\\db\\ColumnSchema\r\n{\r\n    public function dbTypecast($value)\r\n    {\r\n        if($value instanceof \\DateTime){\r\n            return $value->format(?);\r\n        }\r\n        \r\n        return parent::dbTypecast($value);\r\n    }\r\n}\r\n```\r\nconfig-db.php\r\n```php\r\n'db' => [\r\n    'class' => 'yii\\db\\Connection',\r\n    'schemaMap' => [\r\n        'pgsql' => [\r\n            'class' => \\yii\\db\\pgsql\\Schema::class,\r\n            'columnSchemaClass' => \\common\\CustomColumnSchema::class\r\n        ]\r\n    ]\r\n ]\r\n```\r\n\r\n","created_at":"2016-10-24T07:47:13Z","updated_at":"2016-10-24T11:36:43Z","closed_at":"2016-10-24T11:36:42Z","merged_at":"2016-10-24T11:36:42Z","merge_commit_sha":"71d083d49921229d447358ee4bb722abe052af8e","assignee":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"assignees":[{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/20","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.11","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/20/labels","id":1736699,"number":20,"title":"2.0.11","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":120,"closed_issues":9,"state":"open","created_at":"2016-04-28T15:04:50Z","updated_at":"2016-10-24T11:36:42Z","due_on":"2016-12-18T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/yiisoft/yii2/pulls/12816/commits","review_comments_url":"https://api.github.com/repos/yiisoft/yii2/pulls/12816/comments","review_comment_url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/12816/comments","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/a0b7d8541fc49054d1037ac72f1b7d220400a77b","head":{"label":"nanodesu88:schema-column","ref":"schema-column","sha":"a0b7d8541fc49054d1037ac72f1b7d220400a77b","user":{"login":"nanodesu88","id":13536462,"avatar_url":"https://avatars.githubusercontent.com/u/13536462?v=3","gravatar_id":"","url":"https://api.github.com/users/nanodesu88","html_url":"https://github.com/nanodesu88","followers_url":"https://api.github.com/users/nanodesu88/followers","following_url":"https://api.github.com/users/nanodesu88/following{/other_user}","gists_url":"https://api.github.com/users/nanodesu88/gists{/gist_id}","starred_url":"https://api.github.com/users/nanodesu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanodesu88/subscriptions","organizations_url":"https://api.github.com/users/nanodesu88/orgs","repos_url":"https://api.github.com/users/nanodesu88/repos","events_url":"https://api.github.com/users/nanodesu88/events{/privacy}","received_events_url":"https://api.github.com/users/nanodesu88/received_events","type":"User","site_admin":false},"repo":{"id":71567634,"name":"yii2","full_name":"nanodesu88/yii2","owner":{"login":"nanodesu88","id":13536462,"avatar_url":"https://avatars.githubusercontent.com/u/13536462?v=3","gravatar_id":"","url":"https://api.github.com/users/nanodesu88","html_url":"https://github.com/nanodesu88","followers_url":"https://api.github.com/users/nanodesu88/followers","following_url":"https://api.github.com/users/nanodesu88/following{/other_user}","gists_url":"https://api.github.com/users/nanodesu88/gists{/gist_id}","starred_url":"https://api.github.com/users/nanodesu88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanodesu88/subscriptions","organizations_url":"https://api.github.com/users/nanodesu88/orgs","repos_url":"https://api.github.com/users/nanodesu88/repos","events_url":"https://api.github.com/users/nanodesu88/events{/privacy}","received_events_url":"https://api.github.com/users/nanodesu88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nanodesu88/yii2","description":"Yii 2 framework main development repo","fork":true,"url":"https://api.github.com/repos/nanodesu88/yii2","forks_url":"https://api.github.com/repos/nanodesu88/yii2/forks","keys_url":"https://api.github.com/repos/nanodesu88/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nanodesu88/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nanodesu88/yii2/teams","hooks_url":"https://api.github.com/repos/nanodesu88/yii2/hooks","issue_events_url":"https://api.github.com/repos/nanodesu88/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/nanodesu88/yii2/events","assignees_url":"https://api.github.com/repos/nanodesu88/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/nanodesu88/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/nanodesu88/yii2/tags","blobs_url":"https://api.github.com/repos/nanodesu88/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nanodesu88/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nanodesu88/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/nanodesu88/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nanodesu88/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/nanodesu88/yii2/languages","stargazers_url":"https://api.github.com/repos/nanodesu88/yii2/stargazers","contributors_url":"https://api.github.com/repos/nanodesu88/yii2/contributors","subscribers_url":"https://api.github.com/repos/nanodesu88/yii2/subscribers","subscription_url":"https://api.github.com/repos/nanodesu88/yii2/subscription","commits_url":"https://api.github.com/repos/nanodesu88/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/nanodesu88/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/nanodesu88/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/nanodesu88/yii2/issues/comments{/number}","contents_url":"https://api.github.com/repos/nanodesu88/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/nanodesu88/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nanodesu88/yii2/merges","archive_url":"https://api.github.com/repos/nanodesu88/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nanodesu88/yii2/downloads","issues_url":"https://api.github.com/repos/nanodesu88/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/nanodesu88/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/nanodesu88/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/nanodesu88/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nanodesu88/yii2/labels{/name}","releases_url":"https://api.github.com/repos/nanodesu88/yii2/releases{/id}","deployments_url":"https://api.github.com/repos/nanodesu88/yii2/deployments","created_at":"2016-10-21T13:33:27Z","updated_at":"2016-10-21T13:33:32Z","pushed_at":"2016-10-24T11:35:40Z","git_url":"git://github.com/nanodesu88/yii2.git","ssh_url":"git@github.com:nanodesu88/yii2.git","clone_url":"https://github.com/nanodesu88/yii2.git","svn_url":"https://github.com/nanodesu88/yii2","homepage":"http://www.yiiframework.com","size":40579,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yiisoft:master","ref":"master","sha":"73a30780b384d90605a7091d61ac302c902e6e4c","user":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"repo":{"id":3431193,"name":"yii2","full_name":"yiisoft/yii2","owner":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yiisoft/yii2","description":"Yii 2 framework main development repo","fork":false,"url":"https://api.github.com/repos/yiisoft/yii2","forks_url":"https://api.github.com/repos/yiisoft/yii2/forks","keys_url":"https://api.github.com/repos/yiisoft/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yiisoft/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yiisoft/yii2/teams","hooks_url":"https://api.github.com/repos/yiisoft/yii2/hooks","issue_events_url":"https://api.github.com/repos/yiisoft/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/yiisoft/yii2/events","assignees_url":"https://api.github.com/repos/yiisoft/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/yiisoft/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/yiisoft/yii2/tags","blobs_url":"https://api.github.com/repos/yiisoft/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yiisoft/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yiisoft/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/yiisoft/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/yiisoft/yii2/languages","stargazers_url":"https://api.github.com/repos/yiisoft/yii2/stargazers","contributors_url":"https://api.github.com/repos/yiisoft/yii2/contributors","subscribers_url":"https://api.github.com/repos/yiisoft/yii2/subscribers","subscription_url":"https://api.github.com/repos/yiisoft/yii2/subscription","commits_url":"https://api.github.com/repos/yiisoft/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/yiisoft/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/yiisoft/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/yiisoft/yii2/issues/comments{/number}","contents_url":"https://api.github.com/repos/yiisoft/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/yiisoft/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yiisoft/yii2/merges","archive_url":"https://api.github.com/repos/yiisoft/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yiisoft/yii2/downloads","issues_url":"https://api.github.com/repos/yiisoft/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/yiisoft/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/yiisoft/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/yiisoft/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yiisoft/yii2/labels{/name}","releases_url":"https://api.github.com/repos/yiisoft/yii2/releases{/id}","deployments_url":"https://api.github.com/repos/yiisoft/yii2/deployments","created_at":"2012-02-13T15:32:36Z","updated_at":"2016-10-24T10:37:33Z","pushed_at":"2016-10-24T11:36:43Z","git_url":"git://github.com/yiisoft/yii2.git","ssh_url":"git@github.com:yiisoft/yii2.git","clone_url":"https://github.com/yiisoft/yii2.git","svn_url":"https://github.com/yiisoft/yii2","homepage":"http://www.yiiframework.com","size":64335,"stargazers_count":8930,"watchers_count":8930,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5193,"mirror_url":null,"open_issues_count":972,"forks":5193,"open_issues":972,"watchers":8930,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/12816"},"html":{"href":"https://github.com/yiisoft/yii2/pull/12816"},"issue":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/12816"},"comments":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/12816/comments"},"review_comments":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/12816/comments"},"review_comment":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/12816/commits"},"statuses":{"href":"https://api.github.com/repos/yiisoft/yii2/statuses/a0b7d8541fc49054d1037ac72f1b7d220400a77b"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"comments":3,"review_comments":1,"commits":6,"additions":9,"deletions":1,"changed_files":2}}
{"actor":{"display_login":"samdark"}}