Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youknowriad/rizewayjobbundle
A simple job bundle for symfony 2 projects (with doctrine)
https://github.com/youknowriad/rizewayjobbundle
Last synced: 4 days ago
JSON representation
A simple job bundle for symfony 2 projects (with doctrine)
- Host: GitHub
- URL: https://github.com/youknowriad/rizewayjobbundle
- Owner: youknowriad
- License: other
- Created: 2012-09-12T14:52:42.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-10-24T14:42:34.000Z (about 12 years ago)
- Last Synced: 2024-10-15T04:22:42.205Z (29 days ago)
- Language: PHP
- Size: 119 KB
- Stars: 2
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
RizewayJobBundle
================A simple job bundle for symfony 2 projects (with doctrine)
Installation
------------1. Add this bundle into your project *composer.json* file:
```json
"require": {
"rizeway/job-bundle": "dev-master"
},
```
2. Update your composer dependancies.composer.phar update
3. Register this bundle in your *app/AppKernel.php*
```php
setRequired(array(
'my_required_option',
));
}public function run()
{
$this->log('My Option Is : '.$this->getOption('my_required_option'));
....
}
```3. Scheduling a job
Scheduling a job is done like this
```php
setName('Job Name');
$job->setType('Job Type');
$job->setClassname('\MyBundle\JobHandler\MyJobHandler');
$job->setOptions(array(
'my_required_option' => 'option_value'
));$this->getDoctrine()->getEntityManager()->persist($job);
$this->getDoctrine()->getEntityManager()->flush();
....
}
```Advanced Usage
--------------1. Logger
The DoctrineLogger instance is available through a service.
If you want to create your own Logger class and use it in the DaemonCommand, just create a new class which implements the JobLoggerInterface and declare it as a service.Below is an example:
```yml
parameters:
rizeway_job.logger.class: Acme\AcmeBundle\Logger\AcmeLogger
```