<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wyrihaximus / tactician-job-command-mapper example snippets
namespace Test\App\Commands;
use WyriHaximus\Tactician\JobCommand\Annotations\Job;
/**
* @Job("awesomesauce")
* OR
* @Job({"awesomesauce", "sauceawesome"})
*/
class AwesomesauceCommand
{
}
use League\Tactician\Setup\QuickStart;
$map = (new Mapper())->map('src' . DS . 'CommandBus');
$job = 'awesomesauce';
// True when it has a command or false when it doesn't
$map->hasCommand($job);
$job = 'awesomesauce';
// Command class when it has a command, or throws an exception when it doesn't
$command = $map->getCommand($job);
// Call the command bus with the command we found to handle the given job
$commandBus->handle(new $command(...$data));