{"action":"created","issue":{"url":"https://api.github.com/repos/SaftIng/Saft/issues/17","labels_url":"https://api.github.com/repos/SaftIng/Saft/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/SaftIng/Saft/issues/17/comments","events_url":"https://api.github.com/repos/SaftIng/Saft/issues/17/events","html_url":"https://github.com/SaftIng/Saft/issues/17","id":73366878,"number":17,"title":"Create a factory-solution / start using dependency injection","user":{"login":"k00ni","id":381727,"avatar_url":"https://avatars.githubusercontent.com/u/381727?v=3","gravatar_id":"","url":"https://api.github.com/users/k00ni","html_url":"https://github.com/k00ni","followers_url":"https://api.github.com/users/k00ni/followers","following_url":"https://api.github.com/users/k00ni/following{/other_user}","gists_url":"https://api.github.com/users/k00ni/gists{/gist_id}","starred_url":"https://api.github.com/users/k00ni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k00ni/subscriptions","organizations_url":"https://api.github.com/users/k00ni/orgs","repos_url":"https://api.github.com/users/k00ni/repos","events_url":"https://api.github.com/users/k00ni/events{/privacy}","received_events_url":"https://api.github.com/users/k00ni/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Backend","name":"Backend","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Cache","name":"Cache","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Data","name":"Data","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Enhancement","name":"Enhancement","color":"207de5"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/QueryCache","name":"QueryCache","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Rdf","name":"Rdf","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Sparql","name":"Sparql","color":"fef2c0"},{"url":"https://api.github.com/repos/SaftIng/Saft/labels/Store","name":"Store","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/SaftIng/Saft/milestones/1","html_url":"https://github.com/SaftIng/Saft/milestones/0.1","labels_url":"https://api.github.com/repos/SaftIng/Saft/milestones/1/labels","id":1061889,"number":1,"title":"0.1","description":"See also: http://safting.github.io/org/agenda/","creator":{"login":"k00ni","id":381727,"avatar_url":"https://avatars.githubusercontent.com/u/381727?v=3","gravatar_id":"","url":"https://api.github.com/users/k00ni","html_url":"https://github.com/k00ni","followers_url":"https://api.github.com/users/k00ni/followers","following_url":"https://api.github.com/users/k00ni/following{/other_user}","gists_url":"https://api.github.com/users/k00ni/gists{/gist_id}","starred_url":"https://api.github.com/users/k00ni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k00ni/subscriptions","organizations_url":"https://api.github.com/users/k00ni/orgs","repos_url":"https://api.github.com/users/k00ni/repos","events_url":"https://api.github.com/users/k00ni/events{/privacy}","received_events_url":"https://api.github.com/users/k00ni/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":20,"state":"open","created_at":"2015-04-10T12:51:21Z","updated_at":"2015-05-16T08:39:35Z","due_on":"2015-05-28T22:00:00Z","closed_at":null},"comments":15,"created_at":"2015-05-05T16:49:00Z","updated_at":"2015-05-18T12:39:37Z","closed_at":null,"body":"We need factories for all classes. Furthermore we will start using DI to improve the factory solution.\r\n- [x] NodeFactory\r\n- [x] StatementFactory\r\n- [x] CacheFactory\r\n- [x] StoreFactory (Maybe this is somehow the same as Store Chain)\r\n- [ ] ParserFactory\r\n- [ ] SerializerFactory\r\n- [x] ChainFactory (see #6)\r\n- [ ] QueryFactory\r\n- [ ] ResultFactory"},"comment":{"url":"https://api.github.com/repos/SaftIng/Saft/issues/comments/103046239","html_url":"https://github.com/SaftIng/Saft/issues/17#issuecomment-103046239","issue_url":"https://api.github.com/repos/SaftIng/Saft/issues/17","id":103046239,"user":{"login":"k00ni","id":381727,"avatar_url":"https://avatars.githubusercontent.com/u/381727?v=3","gravatar_id":"","url":"https://api.github.com/users/k00ni","html_url":"https://github.com/k00ni","followers_url":"https://api.github.com/users/k00ni/followers","following_url":"https://api.github.com/users/k00ni/following{/other_user}","gists_url":"https://api.github.com/users/k00ni/gists{/gist_id}","starred_url":"https://api.github.com/users/k00ni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k00ni/subscriptions","organizations_url":"https://api.github.com/users/k00ni/orgs","repos_url":"https://api.github.com/users/k00ni/repos","events_url":"https://api.github.com/users/k00ni/events{/privacy}","received_events_url":"https://api.github.com/users/k00ni/received_events","type":"User","site_admin":false},"created_at":"2015-05-18T12:39:37Z","updated_at":"2015-05-18T12:39:37Z","body":"We decided, that we do not wanna use Dice at this level. Using a DI-container makes sense for the application level, where you want to put Saft and your application/business logic together.\r\n\r\nTherefore:\r\n- Remove **StoreFactory**\r\n- Remove **di-dice** branch\r\n- If we ever need a DI-container, we prefer Dice because it does not force you to annotate your code (e.g. with @) and is very lightweight.\r\n\r\nThat decision also mean, that we keep program in the same way as we did, by giving fresh instances into a class only via constructor. New-calls are only allowed when you instantiate such a class which needs certain instances, such as QueryCache, which needs an instance of CacheFactory. But if you instantiate QueryCache directly, you at a level where you want to use it directly, so you can do it the *old way*:\r\n\r\n```\r\nnew QueryCache(new ..., ... );\r\n```\r\n\r\nor you use a DI-container like Dice:\r\n\r\n```\r\n$dice = new Dice();\r\n$dice->create('Saft\\QueryCache\\QueryCache');\r\n```\r\n\r\nwhich does most of the init-part for you."}}