{"action":"opened","issue":{"url":"https://api.github.com/repos/heartsentwined/zf2-cron/issues/8","labels_url":"https://api.github.com/repos/heartsentwined/zf2-cron/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/heartsentwined/zf2-cron/issues/8/comments","events_url":"https://api.github.com/repos/heartsentwined/zf2-cron/issues/8/events","html_url":"https://github.com/heartsentwined/zf2-cron/issues/8","id":56891794,"number":8,"title":"cron service","user":{"login":"isisis","id":3980761,"avatar_url":"https://avatars.githubusercontent.com/u/3980761?v=3","gravatar_id":"","url":"https://api.github.com/users/isisis","html_url":"https://github.com/isisis","followers_url":"https://api.github.com/users/isisis/followers","following_url":"https://api.github.com/users/isisis/following{/other_user}","gists_url":"https://api.github.com/users/isisis/gists{/gist_id}","starred_url":"https://api.github.com/users/isisis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isisis/subscriptions","organizations_url":"https://api.github.com/users/isisis/orgs","repos_url":"https://api.github.com/users/isisis/repos","events_url":"https://api.github.com/users/isisis/events{/privacy}","received_events_url":"https://api.github.com/users/isisis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-07T01:45:44Z","updated_at":"2015-02-07T01:45:44Z","closed_at":null,"body":"Hey,\r\n\r\nI think you're not doing the things the ZF2 way. \r\nI was surprised when I saw:\r\n\r\nCron::register(\r\n    'foo',\r\n    '*/15 * * * *',\r\n    'Foo::runCron',\r\n    array('bar', 'baz')\r\n);\r\n\r\nWhy don't you make use of the service manager?\r\n\r\nWhere in the zf2 application are you exactly using this static call to add cron tasks? Bootstrap method of modules?\r\n\r\nI would suggest to use a service that gets the configuration injected. In any module one could add then cron configurations like:\r\n\r\nheartsentwinedCron => array(\r\n     'alias'=>'foo',\r\n     'route'=>'routeInYourRouteConfig',\r\n     'interval'=>'*/15 * * * *',\r\n     'properties'=>array(\r\n              'something'=>'bar',\r\n              'somethingElse'=>'baz'\r\n      ),\r\n)\r\n\r\nThen one could define a route in routes config and implement a custom controller where the route points to.\r\n\r\nSomething like this would be the ZF2 best practice.\r\n"}}