'ids' => ArrayParameterType::STRING
] );
});
$updated =
$this->connection->
fetchFirstColumn( 'SELECT LOWER(HEX(id)) FROM product WHERE available = 0 AND id IN (:ids) AND product.version_id = :version',
['ids' =>
$bytes, 'version' => Uuid::
fromHexToBytes($context->
getVersionId())],
['ids' => ArrayParameterType::STRING
] );
if (!
empty($updated)) { $this->dispatcher->
dispatch(new ProductNoLongerAvailableEvent($updated,
$context));
} } /**
* @param list<array{referenced_id: string, quantity: string}> $products
*/
private function updateStockAndSales(array
$products, int
$stockMultiplier): void
{ $query =
new RetryableQuery( $this->connection,
$this->connection->
prepare('UPDATE product SET stock = stock + :quantity, sales = sales - :quantity WHERE id = :id AND version_id = :version'
) );