{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/1296","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/1296/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/1296/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/1296/events","html_url":"https://github.com/phalcon/cphalcon/issues/1296","id":20093146,"number":1296,"title":"[BUG] \\Phalcon\\Mvc\\Model set property to model on relation","user":{"login":"ovr","id":572096,"avatar_url":"https://avatars.githubusercontent.com/u/572096?v=3","gravatar_id":"","url":"https://api.github.com/users/ovr","html_url":"https://github.com/ovr","followers_url":"https://api.github.com/users/ovr/followers","following_url":"https://api.github.com/users/ovr/following{/other_user}","gists_url":"https://api.github.com/users/ovr/gists{/gist_id}","starred_url":"https://api.github.com/users/ovr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovr/subscriptions","organizations_url":"https://api.github.com/users/ovr/orgs","repos_url":"https://api.github.com/users/ovr/repos","events_url":"https://api.github.com/users/ovr/events{/privacy}","received_events_url":"https://api.github.com/users/ovr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phalcon/cphalcon/labels/Bug%20-%20Medium","name":"Bug - Medium","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2013-09-26T07:03:16Z","updated_at":"2015-08-28T21:50:27Z","closed_at":"2015-08-28T21:50:27Z","body":"Hi all\r\ni think this bug on https://github.com/phalcon/cphalcon/blob/master/ext/mvc/model.c#L6192\r\nOn User Model i have relation Notify like \r\n```php\r\n$this->hasOne('id', 'User\\Model\\User\\Notify', 'user_id', array(\r\n\t'foreignKey' => true,\r\n\t'alias' => 'Notify'\r\n));\r\n```\r\ntest code\r\n```php\r\n$notify = \\User\\Model\\User\\Notify::findFirst(1);\r\nvar_dump($notify->toArray());\r\n$notify->adviseToRead = 0; \r\nvar_dump($notify->toArray());\r\n\r\nvar_dump($user->Notify->toArray());\t\t\r\n$user->Notify->adviseToRead = 0; \r\nvar_dump($user->Notify->toArray());\r\n```\r\noutput\r\n```php\r\narray(14) {\r\n  [\"user_id\"]=>\r\n  string(1) \"1\"\r\n  [\"message\"]=>\r\n  string(1) \"1\"\r\n  [\"commented\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_author\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_product\"]=>\r\n  string(1) \"1\"\r\n  [\"my_favorite_author_add_product\"]=>\r\n  string(1) \"1\"\r\n  [\"myproduct_add_to_editors_choice\"]=>\r\n  string(1) \"1\"\r\n  [\"tarif_expire\"]=>\r\n  string(1) \"1\"\r\n  [\"myblog_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"mycomment_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"news\"]=>\r\n  string(1) \"1\"\r\n  [\"feed_report\"]=>\r\n  string(1) \"1\"\r\n  [\"adviseToRead\"]=>\r\n  string(1) \"1\"\r\n  [\"selectionOfProducts\"]=>\r\n  string(1) \"1\"\r\n}\r\narray(14) {\r\n  [\"user_id\"]=>\r\n  string(1) \"1\"\r\n  [\"message\"]=>\r\n  string(1) \"1\"\r\n  [\"commented\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_author\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_product\"]=>\r\n  string(1) \"1\"\r\n  [\"my_favorite_author_add_product\"]=>\r\n  string(1) \"1\"\r\n  [\"myproduct_add_to_editors_choice\"]=>\r\n  string(1) \"1\"\r\n  [\"tarif_expire\"]=>\r\n  string(1) \"1\"\r\n  [\"myblog_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"mycomment_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"news\"]=>\r\n  string(1) \"1\"\r\n  [\"feed_report\"]=>\r\n  string(1) \"1\"\r\n  [\"adviseToRead\"]=>\r\n  int(0)\r\n  [\"selectionOfProducts\"]=>\r\n  string(1) \"1\"\r\n}\r\narray(14) {\r\n  [\"user_id\"]=>\r\n  string(1) \"1\"\r\n  [\"message\"]=>\r\n  string(1) \"1\"\r\n  [\"commented\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_author\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_product\"]=>\r\n  string(1) \"1\"\r\n  [\"my_favorite_author_add_product\"]=>\r\n  string(1) \"1\"\r\n  [\"myproduct_add_to_editors_choice\"]=>\r\n  string(1) \"1\"\r\n  [\"tarif_expire\"]=>\r\n  string(1) \"1\"\r\n  [\"myblog_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"mycomment_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"news\"]=>\r\n  string(1) \"1\"\r\n  [\"feed_report\"]=>\r\n  string(1) \"1\"\r\n  [\"adviseToRead\"]=>\r\n  string(1) \"1\"\r\n  [\"selectionOfProducts\"]=>\r\n  string(1) \"1\"\r\n}\r\narray(14) {\r\n  [\"user_id\"]=>\r\n  string(1) \"1\"\r\n  [\"message\"]=>\r\n  string(1) \"1\"\r\n  [\"commented\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_author\"]=>\r\n  string(1) \"1\"\r\n  [\"favorite_product\"]=>\r\n  string(1) \"1\"\r\n  [\"my_favorite_author_add_product\"]=>\r\n  string(1) \"1\"\r\n  [\"myproduct_add_to_editors_choice\"]=>\r\n  string(1) \"1\"\r\n  [\"tarif_expire\"]=>\r\n  string(1) \"1\"\r\n  [\"myblog_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"mycomment_commented\"]=>\r\n  string(1) \"1\"\r\n  [\"news\"]=>\r\n  string(1) \"1\"\r\n  [\"feed_report\"]=>\r\n  string(1) \"1\"\r\n  [\"adviseToRead\"]=>\r\n  string(1) \"1\"\r\n  [\"selectionOfProducts\"]=>\r\n  string(1) \"1\"\r\n}\r\n```\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1896421-bug-phalcon-mvc-model-set-property-to-model-on-relation?utm_campaign=plugin&utm_content=tracker%2F50707&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F50707&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/135896392","html_url":"https://github.com/phalcon/cphalcon/issues/1296#issuecomment-135896392","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/1296","id":135896392,"user":{"login":"andresgutierrez","id":213590,"avatar_url":"https://avatars.githubusercontent.com/u/213590?v=3","gravatar_id":"","url":"https://api.github.com/users/andresgutierrez","html_url":"https://github.com/andresgutierrez","followers_url":"https://api.github.com/users/andresgutierrez/followers","following_url":"https://api.github.com/users/andresgutierrez/following{/other_user}","gists_url":"https://api.github.com/users/andresgutierrez/gists{/gist_id}","starred_url":"https://api.github.com/users/andresgutierrez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresgutierrez/subscriptions","organizations_url":"https://api.github.com/users/andresgutierrez/orgs","repos_url":"https://api.github.com/users/andresgutierrez/repos","events_url":"https://api.github.com/users/andresgutierrez/events{/privacy}","received_events_url":"https://api.github.com/users/andresgutierrez/received_events","type":"User","site_admin":false},"created_at":"2015-08-28T21:50:27Z","updated_at":"2015-08-28T21:50:27Z","body":"Closed as no script to reproduce was provided"}}