mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fix #19734: PHP 8.1 compatibility fix for $query->orderBy(null)
This commit is contained in:
@ -14,6 +14,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #19689: Remove empty elements from the `class` array in `yii\helpers\BaseHtml::renderTagAttributes()` to prevent unwanted spaces (MoritzLost)
|
- Enh #19689: Remove empty elements from the `class` array in `yii\helpers\BaseHtml::renderTagAttributes()` to prevent unwanted spaces (MoritzLost)
|
||||||
- Chg #19696: Change visibility of `yii\web\View::isPageEnded` to `protected` (lubosdz, samdark)
|
- Chg #19696: Change visibility of `yii\web\View::isPageEnded` to `protected` (lubosdz, samdark)
|
||||||
- Bug #19712: Cast shell_exec() output to string for jsCompressor (impayru)
|
- Bug #19712: Cast shell_exec() output to string for jsCompressor (impayru)
|
||||||
|
- Bug #19734: PHP 8.1 compatibility fix for `$query->orderBy(null)` (uaoleg)
|
||||||
- Bug #19731: Fix `yii\data\Sort` to generate proper link when multisort is on and attribute has a default sort order set (bizley)
|
- Bug #19731: Fix `yii\data\Sort` to generate proper link when multisort is on and attribute has a default sort order set (bizley)
|
||||||
- Bug #19735: Fix `yii\validators\NumberValidator` to use programmable message for the value validation (bizley)
|
- Bug #19735: Fix `yii\validators\NumberValidator` to use programmable message for the value validation (bizley)
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ trait QueryTrait
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ORDER BY part of the query.
|
* Sets the ORDER BY part of the query.
|
||||||
* @param string|array|ExpressionInterface $columns the columns (and the directions) to be ordered by.
|
* @param string|array|ExpressionInterface|null $columns the columns (and the directions) to be ordered by.
|
||||||
* Columns can be specified in either a string (e.g. `"id ASC, name DESC"`) or an array
|
* Columns can be specified in either a string (e.g. `"id ASC, name DESC"`) or an array
|
||||||
* (e.g. `['id' => SORT_ASC, 'name' => SORT_DESC]`).
|
* (e.g. `['id' => SORT_ASC, 'name' => SORT_DESC]`).
|
||||||
*
|
*
|
||||||
@ -358,12 +358,14 @@ trait QueryTrait
|
|||||||
/**
|
/**
|
||||||
* Normalizes format of ORDER BY data.
|
* Normalizes format of ORDER BY data.
|
||||||
*
|
*
|
||||||
* @param array|string|ExpressionInterface $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
|
* @param array|string|ExpressionInterface|null $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function normalizeOrderBy($columns)
|
protected function normalizeOrderBy($columns)
|
||||||
{
|
{
|
||||||
if ($columns instanceof ExpressionInterface) {
|
if (empty($columns)) {
|
||||||
|
return [];
|
||||||
|
} elseif ($columns instanceof ExpressionInterface) {
|
||||||
return [$columns];
|
return [$columns];
|
||||||
} elseif (is_array($columns)) {
|
} elseif (is_array($columns)) {
|
||||||
return $columns;
|
return $columns;
|
||||||
|
Reference in New Issue
Block a user