CakePHP 中的 Find 语句生成一个结构如下的数组。我已经命令我的搜索生成显示的结果集(按 combine_score 排序)。现在,我想对数据应用排序函数以按“average_votes”排序。请参阅下面的“从这个:”/“到这个:”。
我真的很感激任何建议。
From this:
Array
(
[0] => Array
(
[Vehicle] => Array
(
[id] => 52
[user_id] => 101
[name] => Ford
[total_votes] => 5
[average_votes] => 3.8
[combined_score] => 19
)
)
[1] => Array
(
[Vehicle] => Array
(
[id] => 48
[user_id] => 101
[name] => Nissan
[total_votes] => 6
[average_votes] => 5
[combined_score] => 2
)
)
)
To this:
Array
(
[0] => Array
(
[Vehicle] => Array
(
[id] => 48
[user_id] => 101
[name] => Nissan
[total_votes] => 6
[average_votes] => 5
[combined_score] => 2
)
)
[1] => Array
(
[Vehicle] => Array
(
[id] => 52
[user_id] => 101
[name] => Ford
[total_votes] => 5
[average_votes] => 3.8
[combined_score] => 19
)
)
)