如何对“列表”查找器查询进行排序?结果未按定义的顺序显示

How to sort a `list` finder query? Results are not showing up in the defined order

国家未按升序显示。

$coutryTable = TableRegistry::get('Country');
$getall = $coutryTable
    ->find('list', [
        'keyField' => 'phonecode',
        'valueField' => function ($row) {
            return $row['name'] . ' (+ ' . $row['phonecode'] . ')';
        }
    ])
    ->order([
        'Country.name' => 'ASC'
    ]);

试试排序函数https://www.w3schools.com/php/func_array_asort.asp

$coutryTable = TableRegistry::get('Country');
//pr($coutryTable);die();
$getall = $coutryTable->find('list', ['keyField' => 'phonecode', 'valueField' => function ($row) {
            return $row['name'] . ' (+ ' . $row['phonecode'] . ')';
        }])
->toArray();

asort($getAll);

print_r($getAll);

$coutryTable = TableRegistry::get('Country');

    $getall = $coutryTable->find('list', ['keyField' => function ($rows) {
        return $rows['name'] . ' (+ ' . $rows['phonecode'] . ')';
    }, 'valueField' => function ($row) {
        return $row['name'] . ' (+ ' . $row['phonecode'] . ')';
    }])->order(['Country.id' => 'ASC']);