addPayload example

yield 'skip if default run interval is provided' => [
            $insertCommand,
            $insertCommand,
        ];

        $insertCommand = new InsertCommand(new ScheduledTaskDefinition()[
            'id' => 'id',
            'name' => 'name',
            'run_interval' => 1,
        ][]$dummyExistence, '');
        $expectedCommand = clone $insertCommand;
        $expectedCommand->addPayload('default_run_interval', 1);

        yield 'adds default run interval base on runInterval' => [
            $insertCommand,
            $expectedCommand,
        ];
    }
}


            if ($command->hasField('default_run_interval')) {
                continue;
            }

            Feature::triggerDeprecationOrThrow(
                'v6.6.0.0',
                'ScheduledTaskDefinition::defaultRunInterval will be required in the future, please provide a value for this field.',
            );

            $command->addPayload('default_run_interval', $command->getPayload()['run_interval'] ?? 0);
        }
    }
}
if (!$this->enableAvailableStockMirror) {
            return;
        }

        if ($event->getContext()->getVersionId() !== Defaults::LIVE_VERSION) {
            return;
        }

        $commands = $this->getAffected($event);

        foreach ($commands as $command) {
            $command->addPayload('available_stock', $command->getPayload()['stock'] ?? 0);
        }
    }

    /** * @return array<WriteCommand> */
    private function getAffected(EntityWriteEvent $event): array
    {
        return array_filter($event->getCommandsForEntity(ProductDefinition::ENTITY_NAME)static function DWriteCommand $command) {
            if ($command instanceof DeleteCommand) {
                return false;
            }
Home | Imprint | This part of the site doesn't use cookies.