DragonByte Tech
Well-known member
- Affected version
- 2.1.0 Beta 3
Consider a query like this:
Which produces a result like this:
The starting
Yet the final output is not:
I've tested this on PHP 7.0, 7.1 and 7.2.
It's absolutely critical that you preserve the sort order when producing API results.
Fillip
SQL:
SELECT `xf_dbtech_ecommerce_download`.*, `xf_dbtech_ecommerce_product_Product_1`.*, `xf_deletion_log_DeletionLog_2`.*
FROM `xf_dbtech_ecommerce_download`
LEFT JOIN `xf_dbtech_ecommerce_product` AS `xf_dbtech_ecommerce_product_Product_1` ON (`xf_dbtech_ecommerce_product_Product_1`.`product_id` = `xf_dbtech_ecommerce_download`.`product_id`)
LEFT JOIN `xf_deletion_log` AS `xf_deletion_log_DeletionLog_2` ON (`xf_deletion_log_DeletionLog_2`.`content_type` = 'dbtech_ecommerce_download' AND `xf_deletion_log_DeletionLog_2`.`content_id` = `xf_dbtech_ecommerce_download`.`download_id`)
WHERE (`xf_dbtech_ecommerce_download`.`product_id` = 1) AND ((`xf_dbtech_ecommerce_product_Product_1`.`product_state` IN ('visible', 'deleted', 'moderated'))) AND (`xf_dbtech_ecommerce_download`.`download_id` IN (11, 12))
ORDER BY `xf_dbtech_ecommerce_download`.`release_date` DESC
Which produces a result like this:
The starting
ArrayCollection
is sorted correctly:Yet the final output is not:
I've tested this on PHP 7.0, 7.1 and 7.2.
It's absolutely critical that you preserve the sort order when producing API results.
Fillip