{"action":"created","issue":{"url":"https://api.github.com/repos/rdlowrey/auryn/issues/121","labels_url":"https://api.github.com/repos/rdlowrey/auryn/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/rdlowrey/auryn/issues/121/comments","events_url":"https://api.github.com/repos/rdlowrey/auryn/issues/121/events","html_url":"https://github.com/rdlowrey/auryn/issues/121","id":109331388,"number":121,"title":"Sharing same class but different instances","user":{"login":"GreeKatrina","id":6021090,"avatar_url":"https://avatars.githubusercontent.com/u/6021090?v=3","gravatar_id":"","url":"https://api.github.com/users/GreeKatrina","html_url":"https://github.com/GreeKatrina","followers_url":"https://api.github.com/users/GreeKatrina/followers","following_url":"https://api.github.com/users/GreeKatrina/following{/other_user}","gists_url":"https://api.github.com/users/GreeKatrina/gists{/gist_id}","starred_url":"https://api.github.com/users/GreeKatrina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GreeKatrina/subscriptions","organizations_url":"https://api.github.com/users/GreeKatrina/orgs","repos_url":"https://api.github.com/users/GreeKatrina/repos","events_url":"https://api.github.com/users/GreeKatrina/events{/privacy}","received_events_url":"https://api.github.com/users/GreeKatrina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-01T16:02:37Z","updated_at":"2015-10-07T15:51:20Z","closed_at":null,"body":"I was wondering what the result of the two situations below would be. Or what the desired result would be, if it's not that right now.\r\n\r\n```php\r\n$auryn = new Auryn\\Injector;\r\n\r\n$auryn->share('Person');\r\n$person = $auryn->make('Person');\r\n$person->setName('John Snow'); // I enjoy the GOT references in the docs =)\r\n\r\n$person = new Person;\r\n$person->setName('Arya Stark');\r\n$auryn->share($person);\r\n\r\n$final_person = $auryn->make('Person');\r\n```\r\nWill  `$final_person` be the John Snow instance, or will the Arya Stark instance override it?\r\n\r\n```php\r\n$auryn = new Auryn\\Injector;\r\n\r\n$person = new Person();\r\n$person->setName('John Snow');\r\n\r\n$person2 = new Person();\r\n$person2->setName('Arya Stark');\r\n\r\n$auryn->share($person);\r\n$auryn->share($person2);\r\n\r\n$person3 = $auryn->make('Person');\r\n```\r\nPretty much the same question as the first one. \r\n\r\nMy initial assumption is that after sharing the first instance of Person, any attempt to share a different instance of Person afterwards would result in either an error or the first instance overriding the second (The answer to both questions would be John Snow).\r\n\r\nHowever, after looking at the `Injector->shareInstance()` method, it seems like the answer to both of the questions would be Arya Stark. "},"comment":{"url":"https://api.github.com/repos/rdlowrey/auryn/issues/comments/146241217","html_url":"https://github.com/rdlowrey/auryn/issues/121#issuecomment-146241217","issue_url":"https://api.github.com/repos/rdlowrey/auryn/issues/121","id":146241217,"user":{"login":"kelunik","id":2743004,"avatar_url":"https://avatars.githubusercontent.com/u/2743004?v=3","gravatar_id":"","url":"https://api.github.com/users/kelunik","html_url":"https://github.com/kelunik","followers_url":"https://api.github.com/users/kelunik/followers","following_url":"https://api.github.com/users/kelunik/following{/other_user}","gists_url":"https://api.github.com/users/kelunik/gists{/gist_id}","starred_url":"https://api.github.com/users/kelunik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelunik/subscriptions","organizations_url":"https://api.github.com/users/kelunik/orgs","repos_url":"https://api.github.com/users/kelunik/repos","events_url":"https://api.github.com/users/kelunik/events{/privacy}","received_events_url":"https://api.github.com/users/kelunik/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T15:51:20Z","updated_at":"2015-10-07T15:51:20Z","body":"It's always the last one shared that's used. Do you think there's something wrong with that? What did you expect?"}}