AutomationBundle

The AutomationBundle provides the functionality for managing automated tasks. This tasks can be used for example to publish or unpublish pages at a specific timestamp. This handlers (like publish) can be implemented by the application or any bundle.

../../_images/automation-tab.png

Basic Ideas

The basic idea behind this bundle was to enhance the content manager with the possibility to plan when a page will be online. But also other tasks should be possible. One of many scenarios could be to send a mail after 6 months to check the content of the page

As basic implementation for task scheduling and running the PHP-Task Library and the Bundle was used.

Note

Outside the “automation” bundle the PHP-Task Library can be used for recurring or single-time tasks which are necessary for your application. For more information about the library and the bundle itself take a look at the PHP-Task Documentation.

As recommended run-mode (beside the kernel.terminate Listener) you should use the task:run command inside a cron-job. For the interval of the cron-job you have to decide how precise the task should run at the given timestamp. For example if you choose an interval of 1 hour the tasks will only run each hour.

Installation

All of the dependencies will be installed automatically with sulu/sulu. Because of this you only have to register the AutomationBundle and the TaskBundle in your Kernel and app/config/admin/routing.yml file.

...

// php-task
new Task\TaskBundle\TaskBundle(),

// sulu
new Sulu\Bundle\AutomationBundle\SuluAutomationBundle(),

...
sulu_automation_api:
    type: rest
    resource: "@SuluAutomationBundle/Resources/config/routing_api.xml"
    prefix: /admin/api

sulu_automation:
    type: rest
    resource: "@SuluAutomationBundle/Resources/config/routing.xml"
    prefix: /admin/automation

For recommended run mode and other settings you should use the default configuration.