$this->connection,
$this->connection->
prepare('UPDATE product SET available_stock = available_stock - :quantity WHERE id = :id'
) );
Profiler::
trace('order::update-stock',
static function D
) use ($query,
$ids): void
{ foreach ($ids as $id =>
$quantity) { $query->
execute(['id' => Uuid::
fromHexToBytes((string) $id), 'quantity' =>
$quantity]);
} });
Profiler::
trace('order::update-flag',
function D
) use ($ids,
$event): void
{ $this->
updateAvailableFlag(\
array_keys($ids),
$event->
getContext());
});
} /**
* If the product of an order item changed, the stocks of the old product and the new product must be updated.
*/
public function lineItemWritten(EntityWrittenEvent
$event): void
{ if ($this->
isDisabled()) { return;
}