We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey,
I think you're not doing the things the ZF2 way. I was surprised when I saw:
Cron::register( 'foo', '*/15 * * * *', 'Foo::runCron', array('bar', 'baz') );
Why don't you make use of the service manager?
Where in the zf2 application are you exactly using this static call to add cron tasks? Bootstrap method of modules?
I would suggest to use a service that gets the configuration injected. In any module.config.php one could add then cron configurations like:
heartsentwinedCron => array( 'alias'=>'foo', 'route'=>'routeInYourRouteConfig', 'interval'=>'*/15 * * * *', 'properties'=>array( 'something'=>'bar', 'somethingElse'=>'baz' ), )
Then one could define a route in routes config and implement a custom controller where the route points to.
Something like this would be the ZF2 best practice.
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
I've implemented a module which allows declaring cron jobs in the config
No branches or pull requests
Hey,
I think you're not doing the things the ZF2 way.
I was surprised when I saw:
Cron::register(
'foo',
'*/15 * * * *',
'Foo::runCron',
array('bar', 'baz')
);
Why don't you make use of the service manager?
Where in the zf2 application are you exactly using this static call to add cron tasks? Bootstrap method of modules?
I would suggest to use a service that gets the configuration injected. In any module.config.php one could add then cron configurations like:
heartsentwinedCron => array(
'alias'=>'foo',
'route'=>'routeInYourRouteConfig',
'interval'=>'*/15 * * * *',
'properties'=>array(
'something'=>'bar',
'somethingElse'=>'baz'
),
)
Then one could define a route in routes config and implement a custom controller where the route points to.
Something like this would be the ZF2 best practice.
The text was updated successfully, but these errors were encountered: