mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 05:48:11 +08:00
Fix #7622: Allow yii\data\ArrayDataProvider to control the sort flags for sortModels through yii\data\Sort::sortFlags property
This commit is contained in:
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user