{"record":{"id":"2eb8073055920d2b","repo":"yiisoft/yii2","slug":"only-sort-instance-configuration-array-or-false-i","errorCode":null,"errorMessage":"Only Sort instance, configuration array or false is allowed.","messagePattern":"Only Sort instance, configuration array or false is allowed\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"framework/data/BaseDataProvider.php","lineNumber":270,"sourceCode":"     * - a configuration array for creating the sort definition object. The \"class\" element defaults\n     *   to 'yii\\data\\Sort'\n     * - an instance of [[Sort]] or its subclass\n     * - false, if sorting needs to be disabled.\n     *\n     * @throws InvalidArgumentException\n     */\n    public function setSort($value)\n    {\n        if (is_array($value)) {\n            $config = ['class' => Sort::className()];\n            if ($this->id !== null) {\n                $config['sortParam'] = $this->id . '-sort';\n            }\n            $this->_sort = Yii::createObject(array_merge($config, $value));\n        } elseif ($value instanceof Sort || $value === false) {\n            $this->_sort = $value;\n        } else {\n            throw new InvalidArgumentException('Only Sort instance, configuration array or false is allowed.');\n        }\n    }\n\n    /**\n     * Refreshes the data provider.\n     * After calling this method, if [[getModels()]], [[getKeys()]] or [[getTotalCount()]] is called again,\n     * they will re-execute the query and return the latest data available.\n     */\n    public function refresh()\n    {\n        $this->_totalCount = null;\n        $this->_models = null;\n        $this->_keys = null;\n    }\n}\n","sourceCodeStart":252,"sourceCodeEnd":286,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/data/BaseDataProvider.php#L252-L286","documentation":"Error \"Only Sort instance, configuration array or false is allowed.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/data/BaseDataProvider.php:270 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}