Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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
```