{"record":{"id":"ccfbc8bc3ddeeb41","repo":"yiisoft/yii2","slug":"the-formatter-property-must-be-either-a-format-o","errorCode":null,"errorMessage":"The \"formatter\" property must be either a Format object or a configuration array.","messagePattern":"The \"formatter\" property must be either a Format object or a configuration array\\.","errorType":"exception","errorClass":"InvalidConfigException","httpStatus":null,"severity":"error","filePath":"framework/grid/GridView.php","lineNumber":290,"sourceCode":"     * - `{pager}`: the pager. See [[renderPager()]].\n     */\n    public $layout = \"{summary}\\n{items}\\n{pager}\";\n\n\n    /**\n     * Initializes the grid view.\n     * This method will initialize required property values and instantiate [[columns]] objects.\n     */\n    public function init()\n    {\n        parent::init();\n        if ($this->formatter === null) {\n            $this->formatter = Yii::$app->getFormatter();\n        } elseif (is_array($this->formatter)) {\n            $this->formatter = Yii::createObject($this->formatter);\n        }\n        if (!$this->formatter instanceof Formatter) {\n            throw new InvalidConfigException('The \"formatter\" property must be either a Format object or a configuration array.');\n        }\n        if (!isset($this->filterRowOptions['id'])) {\n            $this->filterRowOptions['id'] = $this->options['id'] . '-filters';\n        }\n\n        $this->initColumns();\n    }\n\n    /**\n     * Runs the widget.\n     */\n    public function run()\n    {\n        $view = $this->getView();\n        GridViewAsset::register($view);\n        $id = $this->options['id'];\n        $options = Json::htmlEncode(array_merge($this->getClientOptions(), ['filterOnFocusOut' => $this->filterOnFocusOut]));\n        $view->registerJs(\"jQuery('#$id').yiiGridView($options);\");","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/grid/GridView.php#L272-L308","documentation":"Error \"The \"formatter\" property must be either a Format object or a configuration array.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/grid/GridView.php:290 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"}