How to convert sql query into cakephp 4.x query

my sql query is

$result = $conn->execute('SELECT rooms.id, rooms.uuid, rooms.name, rooms.dharmshala_id, rooms.room_type_id, rooms.available_room_online - ( SELECT IFNULL(sum(booking_details.quantity), 0)
FROM booking_details WHERE rooms.id = booking_details.room_id
AND booking_details.checkin_date >= ‘2023-07-20 20:00:00’ AND booking_details.checkin_date <= ‘23023-07-22 20:00:00’
) AS remaining FROM rooms WHERE rooms.room_type_id=1
')->fetchAll(‘assoc’);