2017 © Pedro Peláez
 

symfony-bundle taskchain-bundle

Cronjobs made easy for symfony2.

image

eschmar/taskchain-bundle

Cronjobs made easy for symfony2.

  • Tuesday, February 18, 2014
  • by eschmar
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

TaskChainBundle

With this bundle you can assign your services to a taskchain, which is executable by console., (*1)

Installation

Composer (Packagist):, (*2)

"require": {
    "eschmar/taskchain-bundle": "dev-master"
},

app/Appkernel.php:, (*3)

new Eschmar\TaskChainBundle\EschmarTaskChainBundle(),

Usage

The following demo creates a new Task called Test Task which will simply wait 3 seconds before returning. Your service has to extend the provided abstract class TaskAbstract., (*4)

src/Acme/HelloBundle/Task/TestTask.php:, (*5)

namespace Acme\HelloBundle\Task;

use Eschmar\TaskChainBundle\Task\TaskAbstract;

class TestTask extends TaskAbstract
{
    protected function init() {
        $this->name = 'Test Task';
        $this->groups[] = 'test';
    }

    public function execute() {
        sleep(3);
        return true;
    }
}

src/Acme/HelloBundle/Resources/config/services.yml:, (*6)

acme_hello.taskchain_test:
    class: Acme\HelloBundle\Task\TestTask
    tags:
        - { name: taskchain }

Now you can execute the console command:, (*7)

php app/console taskchain [<group>] [--inset]

The command will execute all tagged services meeting the group requirement. Use the --inset option to exclude a group but execute all others., (*8)

Output:, (*9)

$ app/console taskchain

   ______           __      ________          _
  /_  __/___ ______/ /__   / ____/ /_  ____ _(_)___
   / / / __ `/ ___/ //_/  / /   / __ \/ __ `/ / __ \
  / / / /_/ (__  ) ,<    / /___/ / / / /_/ / / / / /
 /_/  \__,_/____/_/|_|   \____/_/ /_/\__,_/_/_/ /_/

 --------------------------- START ---------------------------

 . Test Task... success

 ---------------------------- END ----------------------------

License

MIT License, (*10)

The Versions

18/02 2014

dev-master

9999999-dev https://github.com/eschmar/taskchain-bundle

Cronjobs made easy for symfony2.

  Sources   Download

MIT

The Requires

 

cronjob symfony

17/02 2014

v0.1

0.1.0.0 https://github.com/eschmar/taskchain-bundle

Cronjobs made easy for symfony2.

  Sources   Download

MIT

The Requires

 

cronjob symfony