SELECT order_line_item.id, quantity, referenced_id, state_machine_state.technical_name AS order_status
FROM order_line_item
INNER JOIN `order` ON order_line_item.order_id = `order`.id AND `order`.version_id = :version
INNER JOIN state_machine_state ON `order`.state_id = state_machine_state.id
WHERE order_line_item.id IN (:ids)
AND order_line_item.version_id = :version
AND type = :type
AND state_machine_state.technical_name != :cancelled_state
SQL;
/** @var array<string, array{id: string, quantity: int, referenced_id: string}> $result */
$result =
$this->connection->
fetchAllAssociativeIndexed( $sql,
['ids' =>
$ids, 'version' => Uuid::
fromHexToBytes(Defaults::LIVE_VERSION
), 'type' => LineItem::PRODUCT_LINE_ITEM_TYPE, 'cancelled_state' => OrderStates::STATE_CANCELLED
],
['ids' => ArrayParameterType::STRING
] );
return $result;
} /**
* @return list<array{id: string, product_id: string, quantity: int}>
*/