{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/10846","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10846/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10846/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10846/events","html_url":"https://github.com/phalcon/cphalcon/issues/10846","id":103468741,"number":10846,"title":"Model's setDI method doesn't work ","user":{"login":"Lucups","id":2325891,"avatar_url":"https://avatars.githubusercontent.com/u/2325891?v=3","gravatar_id":"","url":"https://api.github.com/users/Lucups","html_url":"https://github.com/Lucups","followers_url":"https://api.github.com/users/Lucups/followers","following_url":"https://api.github.com/users/Lucups/following{/other_user}","gists_url":"https://api.github.com/users/Lucups/gists{/gist_id}","starred_url":"https://api.github.com/users/Lucups/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lucups/subscriptions","organizations_url":"https://api.github.com/users/Lucups/orgs","repos_url":"https://api.github.com/users/Lucups/repos","events_url":"https://api.github.com/users/Lucups/events{/privacy}","received_events_url":"https://api.github.com/users/Lucups/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-27T09:38:50Z","updated_at":"2015-08-27T09:40:38Z","closed_at":null,"body":"I am using Phalcon in some commands written by PHP,  I inject DI into my BaseCommand, then I think I can use Model's setDI method to inject DI into it, just see the codes:\r\n\r\npart of `console.php`\r\n```\r\n$di = new \\Phalcon\\Di\\FactoryDefault();\r\n// register services\r\nrequire __DIR__ . '/config/services.php';\r\n// inject into BaseCommand\r\n\\Mynamespace\\BaseCommand::setDI($di);\r\n```\r\n\r\npart of MyCommand.php\r\n```\r\n$this->get('hello.srv')->hello(); // works very good, print \"hello\"\r\necho \"\\n\";\r\n$repo = new TimedJob($this->getDI());  // I am trying to inject DI into Model here\r\necho \"try to get db_base service.... \\n\"; \r\nprint_r($repo->getDI()->get('db_base'));  // print the db_base very good\r\necho \"end try \\n\";\r\n\r\n// throw exception: Service 'db_base' wasn't found in the dependency injection container  \r\n$job = $repo::findFirst();\r\n```\r\n\r\nthe screenshot below is the command output:\r\n![Uploading phalcon-bug.png…]()\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/135365521","html_url":"https://github.com/phalcon/cphalcon/issues/10846#issuecomment-135365521","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/10846","id":135365521,"user":{"login":"Lucups","id":2325891,"avatar_url":"https://avatars.githubusercontent.com/u/2325891?v=3","gravatar_id":"","url":"https://api.github.com/users/Lucups","html_url":"https://github.com/Lucups","followers_url":"https://api.github.com/users/Lucups/followers","following_url":"https://api.github.com/users/Lucups/following{/other_user}","gists_url":"https://api.github.com/users/Lucups/gists{/gist_id}","starred_url":"https://api.github.com/users/Lucups/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lucups/subscriptions","organizations_url":"https://api.github.com/users/Lucups/orgs","repos_url":"https://api.github.com/users/Lucups/repos","events_url":"https://api.github.com/users/Lucups/events{/privacy}","received_events_url":"https://api.github.com/users/Lucups/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T09:40:38Z","updated_at":"2015-08-27T09:40:38Z","body":"![phalcon-bug](https://cloud.githubusercontent.com/assets/2325891/9517451/b0642000-4ce2-11e5-847a-642773c87f56.png)\r\n"}}