Skip to content
New issue

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

cron service #8

Open
isisis opened this issue Feb 7, 2015 · 3 comments
Open

cron service #8

isisis opened this issue Feb 7, 2015 · 3 comments

Comments

@isisis
Copy link

isisis commented Feb 7, 2015

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.

@Perfect-Web
Copy link

+1

@popovserhii
Copy link

+1

@popovserhii
Copy link

I've implemented a module which allows declaring cron jobs in the config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants