{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/55","repository_url":"https://api.github.com/repos/spatie/laravel-event-projector","labels_url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/55/comments","events_url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/55/events","html_url":"https://github.com/spatie/laravel-event-projector/issues/55","id":340108629,"node_id":"MDU6SXNzdWUzNDAxMDg2Mjk=","number":55,"title":"Remove constructor arguments restriction for deserialize","user":{"login":"sebastiandedeyne","id":1561079,"node_id":"MDQ6VXNlcjE1NjEwNzk=","avatar_url":"https://avatars2.githubusercontent.com/u/1561079?v=4","gravatar_id":"","url":"https://api.github.com/users/sebastiandedeyne","html_url":"https://github.com/sebastiandedeyne","followers_url":"https://api.github.com/users/sebastiandedeyne/followers","following_url":"https://api.github.com/users/sebastiandedeyne/following{/other_user}","gists_url":"https://api.github.com/users/sebastiandedeyne/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastiandedeyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastiandedeyne/subscriptions","organizations_url":"https://api.github.com/users/sebastiandedeyne/orgs","repos_url":"https://api.github.com/users/sebastiandedeyne/repos","events_url":"https://api.github.com/users/sebastiandedeyne/events{/privacy}","received_events_url":"https://api.github.com/users/sebastiandedeyne/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-11T06:30:36Z","updated_at":"2018-07-23T13:06:41Z","closed_at":"2018-07-23T13:06:41Z","author_association":"MEMBER","body":"Would it be possible to have the deserializer Just Work™️ without us needing to match the constructor signature with the stored attributes?\r\n\r\nThis doesn't work now:\r\n\r\n```php\r\n<?php\r\n\r\nnamespace App\\Products\\Events;\r\n\r\nuse Spatie\\EventProjector\\ShouldBeStored;\r\n\r\nclass ProductCreated implements ShouldBeStored\r\n{\r\n    /** @var string */\r\n    public $id;\r\n\r\n    /** @var string */\r\n    public $name;\r\n\r\n    /** @var int */\r\n    public $price;\r\n\r\n    public function __construct(string $id, array $attributes)\r\n    {\r\n        $this->id = $id;\r\n\r\n        $this->name = $attributes['name'];\r\n        $this->price = $attributes['price'];\r\n    }\r\n}\r\n```\r\n\r\n```\r\nCannot create an instance of App\\Products\\Events\\ProductCreated from serialized data because its constructor requires parameter \"attributes\" to be present.\r\n```"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/comments/407051315","html_url":"https://github.com/spatie/laravel-event-projector/issues/55#issuecomment-407051315","issue_url":"https://api.github.com/repos/spatie/laravel-event-projector/issues/55","id":407051315,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzA1MTMxNQ==","user":{"login":"freekmurze","id":483853,"node_id":"MDQ6VXNlcjQ4Mzg1Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/483853?v=4","gravatar_id":"","url":"https://api.github.com/users/freekmurze","html_url":"https://github.com/freekmurze","followers_url":"https://api.github.com/users/freekmurze/followers","following_url":"https://api.github.com/users/freekmurze/following{/other_user}","gists_url":"https://api.github.com/users/freekmurze/gists{/gist_id}","starred_url":"https://api.github.com/users/freekmurze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freekmurze/subscriptions","organizations_url":"https://api.github.com/users/freekmurze/orgs","repos_url":"https://api.github.com/users/freekmurze/repos","events_url":"https://api.github.com/users/freekmurze/events{/privacy}","received_events_url":"https://api.github.com/users/freekmurze/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T13:06:41Z","updated_at":"2018-07-23T13:06:41Z","author_association":"MEMBER","body":"If you find a good solution, please PR it."}}
{"actor":{"display_login":"freekmurze"}}