// the quantity changed
if ($lineItem['quantity'
] !==
$afterLine['quantity'
]) { return [$this->
changeset($id,
$lineItem['referenced_id'
],
(int) $lineItem['quantity'
],
(int) $afterLine['quantity'
])];
} return [];
} private function changeset(string
$id, string
$productId, int
$qtyBefore, int
$newQty): StockAlteration
{ return new StockAlteration($id,
$productId,
$qtyBefore,
$newQty);
} /**
* @return array<string>
*/
private function getAffectedIds(EntityWriteEvent
$event): array
{ return array_map( static fn (WriteCommand
$command) =>
$command->
getPrimaryKey()['id'
],
array_filter($event->
getCommandsForEntity(OrderLineItemDefinition::ENTITY_NAME
),
static function DWriteCommand
$command) { if ($command instanceof DeleteCommand ||
$command instanceof InsertCommand
) {