diff --git a/DependencyInjection/RewieerTaskSchedulerExtension.php b/DependencyInjection/RewieerTaskSchedulerExtension.php index 525c751..5bebeec 100644 --- a/DependencyInjection/RewieerTaskSchedulerExtension.php +++ b/DependencyInjection/RewieerTaskSchedulerExtension.php @@ -8,6 +8,7 @@ namespace Rewieer\TaskSchedulerBundle\DependencyInjection; +use Rewieer\TaskSchedulerBundle\Task\TaskInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; @@ -16,8 +17,10 @@ class RewieerTaskSchedulerExtension extends Extension { public function load(array $configs, ContainerBuilder $container) { + $container->registerForAutoconfiguration(TaskInterface::class)->addTag('ts.task'); + $configuration = new Configuration(); - $config = $this->processConfiguration($configuration, $configs); + $this->processConfiguration($configuration, $configs); $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); diff --git a/README.md b/README.md index ffb9ed9..23fe427 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For this bundle to work, you must be able to define *CRON* jobs on your server. Start by adding the bundle to your *composer.json* : `composer require rewieer/taskschedulerbundle` -Then add the bundle to your *AppKernel.php* : +Symfony Flex will automatically enable that bundle for you. If you are not using Flex yet, add the bundle to your *AppKernel.php* : ```php // in AppKernel::registerBundles() $bundles = array( @@ -51,14 +51,6 @@ class Task extends AbstractScheduledTask { } ``` -In your *services.xml* : -```xml - - - -``` - Your task is now scheduled and will be called every 5 minutes. - You're good to go! You can now check your logs to see if this is working.