public function __invoke(EntityWriteEvent
$event): void
{ 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
{