{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/10932","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10932/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10932/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10932/events","html_url":"https://github.com/phalcon/cphalcon/issues/10932","id":106017441,"number":10932,"title":"skipAttributes/skipAttributesOnCreate does not work for Primary keys","user":{"login":"nsossonko","id":8125151,"avatar_url":"https://avatars.githubusercontent.com/u/8125151?v=3","gravatar_id":"","url":"https://api.github.com/users/nsossonko","html_url":"https://github.com/nsossonko","followers_url":"https://api.github.com/users/nsossonko/followers","following_url":"https://api.github.com/users/nsossonko/following{/other_user}","gists_url":"https://api.github.com/users/nsossonko/gists{/gist_id}","starred_url":"https://api.github.com/users/nsossonko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsossonko/subscriptions","organizations_url":"https://api.github.com/users/nsossonko/orgs","repos_url":"https://api.github.com/users/nsossonko/repos","events_url":"https://api.github.com/users/nsossonko/events{/privacy}","received_events_url":"https://api.github.com/users/nsossonko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-11T14:02:37Z","updated_at":"2015-09-12T08:19:35Z","closed_at":null,"body":"Hi,\r\n\r\nI am using Mysql and cannot get my primary keys to be skipped during create. In Mysql my primary keys are set to AUTO_INCREMENT. I call model->skipAttributes('id') in initialize, to no avail. If a primary key is set on the model, it will be passed to Mysql and set to that value.\r\n\r\n```php\r\nclass Samples extends \\Phalcon\\Mvc\\Model {\r\n    /**\r\n     * @Primary\r\n     * @Identity\r\n     * @Column(type=\"integer\", nullable=false, length=16)\r\n     */\r\n    public $id;\r\n\r\n    public function initialize() {\r\n        // set model to use dynamic updates\r\n        $this->useDynamicUpdate(true);\r\n\r\n        // id columns will always be auto-generated and immutable\r\n        $this->skipAttributes(array('id'));\r\n    }\r\n}\r\n\r\n$sample = new Samples();\r\n$sample->id = 5;\r\n$sample->create();\r\n$record = Samples::findFirst(5);\r\nvar_dump($record->toArray());\r\n```\r\n\r\n```sql\r\nCREATE TABLE `samples` (\r\n    `id` bigint(16) unsigned NOT NULL AUTO_INCREMENT\r\n    PRIMARY KEY (`id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n```"},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/139739899","html_url":"https://github.com/phalcon/cphalcon/issues/10932#issuecomment-139739899","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10932","id":139739899,"user":{"login":"sszdh","id":7782078,"avatar_url":"https://avatars.githubusercontent.com/u/7782078?v=3","gravatar_id":"","url":"https://api.github.com/users/sszdh","html_url":"https://github.com/sszdh","followers_url":"https://api.github.com/users/sszdh/followers","following_url":"https://api.github.com/users/sszdh/following{/other_user}","gists_url":"https://api.github.com/users/sszdh/gists{/gist_id}","starred_url":"https://api.github.com/users/sszdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sszdh/subscriptions","organizations_url":"https://api.github.com/users/sszdh/orgs","repos_url":"https://api.github.com/users/sszdh/repos","events_url":"https://api.github.com/users/sszdh/events{/privacy}","received_events_url":"https://api.github.com/users/sszdh/received_events","type":"User","site_admin":false},"created_at":"2015-09-12T08:19:34Z","updated_at":"2015-09-12T08:19:34Z","body":"Clear your metadata cache and try again.\nMay helps...\n\nOn Fri, 11 Sep 2015 19:05 nsossonko <notifications@github.com> wrote:\n\n> I removed it and still same story. The id is whatever is assigned to it,\n> it is not skipped.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/phalcon/cphalcon/issues/10932#issuecomment-139562457>.\n>\n"}}