Skip to content

SeahorseReader/Seahorse-Aura-Di-Tactician

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Aura Di ContainerBuiler config for Tactician

A simple aura/di container config for league/tactician.

Add Seahorse\Tactician\Config to your ContainerBuilder.

League\Tactician\CommandBus has the service name league:tactician/commandbus

Mapping commands to handlers

In your ContainerBuilder configuration class you need to map commands to handlers.

$di->set('service-name', $di->lazyNew('Your\Handler'));

$di->values['commandsToHandlersMap'] = [
    YourCommand::CLASS => 'service-name',
];

Adding middleware

Override the middleware params in your ContainerBuilder configuration class.

$di->params['League\Tactician\CommandBus']['middleware'] = $di->lazyArray([
        // add your middleware, order is important
        $di->lazyNew('League\Tactician\Plugins\LockingMiddleware'),
        $di->lazyNew('League\Tactician\Handler\CommandHandlerMiddleware'),
    ]
);