{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/2186","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/2186/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/2186/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/2186/events","html_url":"https://github.com/phalcon/cphalcon/issues/2186","id":29591096,"number":2186,"title":"\\Phalcon\\Mvc\\Model to allow constructor parameters","user":{"login":"hlegius","id":36469,"avatar_url":"https://avatars.githubusercontent.com/u/36469?v=3","gravatar_id":"","url":"https://api.github.com/users/hlegius","html_url":"https://github.com/hlegius","followers_url":"https://api.github.com/users/hlegius/followers","following_url":"https://api.github.com/users/hlegius/following{/other_user}","gists_url":"https://api.github.com/users/hlegius/gists{/gist_id}","starred_url":"https://api.github.com/users/hlegius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hlegius/subscriptions","organizations_url":"https://api.github.com/users/hlegius/orgs","repos_url":"https://api.github.com/users/hlegius/repos","events_url":"https://api.github.com/users/hlegius/events{/privacy}","received_events_url":"https://api.github.com/users/hlegius/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phalcon/cphalcon/labels/Unassigned","name":"Unassigned","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-03-17T19:27:45Z","updated_at":"2015-08-23T03:53:46Z","closed_at":"2015-08-23T03:53:46Z","body":"Hi, guys!\r\nWould be nice if Phalcon adds a readable and transparent way to require/collect parameters on object construction like below:\r\n\r\n```php\r\nuse Phalcon\\Mvc\\Model;\r\n\r\nclass Foo extends Model\r\n{\r\n    public function onConstruct($bar, $baz)\r\n    {\r\n        // do stuff with $bar and $baz\r\n    }\r\n}\r\n```\r\n\r\n\"It prepares the new object for use, often accepting arguments that the constructor uses to set member variables required.\" - [Wikipedia](http://en.wikipedia.org/wiki/Constructor_%28object-oriented_programming%29)\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1896294-phalcon-mvc-model-to-allow-constructor-parameters?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/133778645","html_url":"https://github.com/phalcon/cphalcon/issues/2186#issuecomment-133778645","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/2186","id":133778645,"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-23T03:53:46Z","updated_at":"2015-08-23T03:53:46Z","body":"Implemented in 2.1.x as follows:\r\n\r\n```php\r\n$robot = new Robots(array(\r\n    'name' => 'hello'\r\n    'type' => 'Mechanical'\r\n));\r\n$robot->save();\r\n```"}}