Skip to content

Commit d5a70ca

Browse files
committed
Merge remote-tracking branch 'origin/2026.1' into 2026.x
2 parents ea77609 + a299da7 commit d5a70ca

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

src/ExecutionEngine/AutomationAction/AbstractHandler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Pimcore\Model\Element\ElementDescriptor;
3333
use Pimcore\Model\Element\ElementInterface;
3434
use Pimcore\Model\UserInterface;
35+
use function array_key_exists;
3536

3637
/**
3738
* @internal
@@ -156,6 +157,16 @@ protected function getElementById(
156157
throw new EnvironmentException('How did I get here?');
157158
}
158159

160+
protected function extractOptionalConfigFieldFromJobStepConfig(
161+
GenericExecutionEngineMessageInterface $message,
162+
string $key,
163+
mixed $default = null,
164+
): mixed {
165+
$config = $this->getCurrentJobStepConfig($message);
166+
167+
return array_key_exists($key, $config) ? $config[$key] : $default;
168+
}
169+
159170
protected function updateContextArrayValues(JobRun $jobRun, string $key, array $value): void
160171
{
161172
$context = $jobRun->getContext();

src/Export/ExecutionEngine/AutomationAction/Messenger/Handler/CsvCreationHandler.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Pimcore\Bundle\StudioBackendBundle\Export\ExecutionEngine\AutomationAction\Messenger\Messages\CsvCreationMessage;
2323
use Pimcore\Bundle\StudioBackendBundle\Export\Model\GridExportData;
2424
use Pimcore\Bundle\StudioBackendBundle\Export\Service\ExportServiceInterface;
25-
use Pimcore\Bundle\StudioBackendBundle\Export\Util\Trait\ExportCreationHandlerSetupTrait;
2625
use Pimcore\Bundle\StudioBackendBundle\Mercure\Service\PublishServiceInterface;
2726
use Pimcore\Bundle\StudioBackendBundle\Mercure\Service\UserTopicServiceInterface;
2827
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
@@ -33,7 +32,6 @@
3332
#[AsMessageHandler]
3433
final class CsvCreationHandler extends AbstractHandler
3534
{
36-
use ExportCreationHandlerSetupTrait;
3735
use HandlerProgressTrait;
3836

3937
public function __construct(
@@ -66,8 +64,8 @@ public function __invoke(CsvCreationMessage $message): void
6664

6765
$columns = $this->extractConfigFieldFromJobStepConfig($message, StepConfig::CONFIG_COLUMNS->value);
6866
$settings = $this->extractConfigFieldFromJobStepConfig($message, StepConfig::CONFIG_CONFIGURATION->value);
69-
$elementType = $this->extractConfigFieldFromJobStepConfig($message, StepConfig::ELEMENT_TYPE->value);
70-
$classId = $this->extractConfigFieldFromJobStepConfig($message, StepConfig::ELEMENT_CLASS_ID->value);
67+
$elementType = $this->extractOptionalConfigFieldFromJobStepConfig($message, StepConfig::ELEMENT_TYPE->value);
68+
$classId = $this->extractOptionalConfigFieldFromJobStepConfig($message, StepConfig::ELEMENT_CLASS_ID->value);
7169
$headers = $settings[StepConfig::SETTINGS_HEADER->value] ?? StepConfig::SETTINGS_HEADER_NO_HEADER->value;
7270
$delimiter = $settings[StepConfig::SETTINGS_DELIMITER->value] ?? null;
7371

@@ -106,4 +104,24 @@ public function __invoke(CsvCreationMessage $message): void
106104
$this->getJobStep($message)->getName()
107105
);
108106
}
107+
108+
protected function configureStep(): void
109+
{
110+
$this->stepConfiguration->setRequired(StepConfig::CONFIG_CONFIGURATION->value);
111+
$this->stepConfiguration->setAllowedTypes(
112+
StepConfig::CONFIG_CONFIGURATION->value,
113+
StepConfig::CONFIG_TYPE_ARRAY->value
114+
);
115+
$this->stepConfiguration->setRequired(StepConfig::CONFIG_COLUMNS->value);
116+
$this->stepConfiguration->setAllowedTypes(
117+
StepConfig::CONFIG_COLUMNS->value,
118+
StepConfig::CONFIG_TYPE_ARRAY->value
119+
);
120+
$this->stepConfiguration->setDefaults([
121+
StepConfig::CONFIG_COLUMNS->value => [],
122+
StepConfig::CONFIG_CONFIGURATION->value => [],
123+
StepConfig::ELEMENT_TYPE->value => null,
124+
StepConfig::ELEMENT_CLASS_ID->value => null,
125+
]);
126+
}
109127
}

0 commit comments

Comments
 (0)