Files
piratepoet/mailpoet/lib/Automation/Engine/Control/StepRunControllerFactory.php
Arnaud Berthomier 815ff9211b Reuse StepRunLogger to avoid overwrites
The SendEmailAction step needs to log arbitrary data to allow
retry-runs, through a StepRunLogger. We previously instanciated a logger
from the action, but this data will be overwritten by the handler right
after the action is run. This is because the handler holds a reference
to a logger already, and will overwrite any data the action tries to
write.

To work around this issue, the step handler now passes its logger
instance to the step's controller, allowing safe access from
SendEmailAction.

[MAILPOET-6176]
2025-01-20 13:20:59 +01:00

22 lines
567 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Control;
use MailPoet\Automation\Engine\Control\StepRunLogger;
use MailPoet\Automation\Engine\Data\StepRunArgs;
class StepRunControllerFactory {
/** @var StepScheduler */
private $stepScheduler;
public function __construct(
StepScheduler $stepScheduler
) {
$this->stepScheduler = $stepScheduler;
}
public function createController(StepRunArgs $args, StepRunLogger $logger): StepRunController {
return new StepRunController($this->stepScheduler, $args, $logger);
}
}