Open
Description
I have CommandA with ONE decorator class.
I have CommandB with NO decorator classes.
In CommandA handler, I execute CommandB.
By right, when I execute CommandA, these steps should happen:
1- Decorator of CommandA should be executed
2- CommandA handler should be called
3- CommandB handler should be called
However, I found that the decorator class of CommandA will execute twice:
1- Decorator of CommandA is executed
2- CommandA handler is called
3- Decorator of CommandA is executed again
4- CommandB handler is called
I managed to fix the issue by adding this check to CommanderTrait->execute() function:
if (empty($decorators))
{
$bus->emptyDecorators();
}
where emptyDecorators() is defined in CommandBus implementation as:
/**
* Remove all
*/
public function emptyDecorators ()
{
$this->decorators = [];
}
Thanks.
Metadata
Metadata
Assignees
Labels
No labels