|
22 | 22 | use Pimcore\Bundle\StudioBackendBundle\Export\ExecutionEngine\AutomationAction\Messenger\Messages\CsvCreationMessage; |
23 | 23 | use Pimcore\Bundle\StudioBackendBundle\Export\Model\GridExportData; |
24 | 24 | use Pimcore\Bundle\StudioBackendBundle\Export\Service\ExportServiceInterface; |
25 | | -use Pimcore\Bundle\StudioBackendBundle\Export\Util\Trait\ExportCreationHandlerSetupTrait; |
26 | 25 | use Pimcore\Bundle\StudioBackendBundle\Mercure\Service\PublishServiceInterface; |
27 | 26 | use Pimcore\Bundle\StudioBackendBundle\Mercure\Service\UserTopicServiceInterface; |
28 | 27 | use Symfony\Component\Messenger\Attribute\AsMessageHandler; |
|
33 | 32 | #[AsMessageHandler] |
34 | 33 | final class CsvCreationHandler extends AbstractHandler |
35 | 34 | { |
36 | | - use ExportCreationHandlerSetupTrait; |
37 | 35 | use HandlerProgressTrait; |
38 | 36 |
|
39 | 37 | public function __construct( |
@@ -66,8 +64,8 @@ public function __invoke(CsvCreationMessage $message): void |
66 | 64 |
|
67 | 65 | $columns = $this->extractConfigFieldFromJobStepConfig($message, StepConfig::CONFIG_COLUMNS->value); |
68 | 66 | $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); |
71 | 69 | $headers = $settings[StepConfig::SETTINGS_HEADER->value] ?? StepConfig::SETTINGS_HEADER_NO_HEADER->value; |
72 | 70 | $delimiter = $settings[StepConfig::SETTINGS_DELIMITER->value] ?? null; |
73 | 71 |
|
@@ -106,4 +104,24 @@ public function __invoke(CsvCreationMessage $message): void |
106 | 104 | $this->getJobStep($message)->getName() |
107 | 105 | ); |
108 | 106 | } |
| 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 | + } |
109 | 127 | } |
0 commit comments