Fix #7622: Allow yii\data\ArrayDataProvider to control the sort flags for sortModels through yii\data\Sort::sortFlags property

This commit is contained in:
Arthur Skobara
2020-02-04 15:56:35 +07:00
committed by GitHub
parent 15d425a3e3
commit a19dd48b79
4 changed files with 34 additions and 1 deletions

View File

@ -7,6 +7,7 @@ Yii Framework 2 Change Log
- Bug #17843: Fix `yii\web\Session::setCookieParamsInternal` check param "samesite" (schevgeny)
- Bug #17828: Fix `yii\web\UploadedFile::saveAs()` failing when error value in `$_FILES` entry is a string (haveyaseen)
- Bug #17829: `yii\helpers\ArrayHelper::filter` now correctly filters data when passing a filter with more than 2 levels (rhertogh)
- Enh #7622: Allow `yii\data\ArrayDataProvider` to control the sort flags for `sortModels` through `yii\data\Sort::sortFlags` property (askobara)
2.0.32 January 21, 2020

View File

@ -136,7 +136,7 @@ class ArrayDataProvider extends BaseDataProvider
{
$orders = $sort->getOrders();
if (!empty($orders)) {
ArrayHelper::multisort($models, array_keys($orders), array_values($orders));
ArrayHelper::multisort($models, array_keys($orders), array_values($orders), $sort->sortFlags);
}
return $models;

View File

@ -186,6 +186,12 @@ class Sort extends BaseObject
*/
public $urlManager;
/**
* @var int Allow to control a value of the fourth parameter which will be
* passed to [[ArrayHelper::multisort()]]
* @since 2.0.33
*/
public $sortFlags = SORT_REGULAR;
/**
* Normalizes the [[attributes]] property.