{"record":{"id":"ab61e28ecfff8cb9","repo":"octobercms/october","slug":"model-class-does-not-contain-a-method-method","errorCode":null,"errorMessage":"Model ':class' does not contain a method ':method'.","messagePattern":"Model ':class' does not contain a method ':method'\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/formwidgets/datatable/LegacyDataTable.php","lineNumber":113,"sourceCode":"        $config->alias = studly_case(HtmlHelper::nameToId($fieldName)) . 'datatable';\n        $config->fieldName = $fieldName;\n\n        $table = new Table($this->controller, $config);\n        $table->bindEvent('table.getDropdownOptions', [$this, 'getLegacyDataTableOptions']);\n        $table->bindEvent('table.getAutocompleteOptions', [$this, 'getLegacyDataTableOptions']);\n\n        return $table;\n    }\n\n    /**\n     * getLegacyDataTableOptions is the legacy dropdown/autocomplete option callback handler\n     */\n    public function getLegacyDataTableOptions($columnName, $rowData)\n    {\n        $methodName = 'get' . studly_case($this->fieldName) . 'DataTableOptions';\n\n        if (!$this->model->methodExists($methodName) && !$this->model->methodExists('getDataTableOptions')) {\n            throw new ApplicationException(\n                Lang::get(\n                    'backend::lang.model.missing_method',\n                    [\n                        'class' => get_class($this->model),\n                        'method' => 'getDataTableOptions'\n                    ]\n                )\n            );\n        }\n\n        if ($this->model->methodExists($methodName)) {\n            $result = $this->model->$methodName($columnName, $rowData);\n        }\n        else {\n            $result = $this->model->getDataTableOptions($this->fieldName, $columnName, $rowData);\n        }\n\n        if (!is_array($result)) {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/formwidgets/datatable/LegacyDataTable.php#L95-L131","documentation":"Thrown by LegacyDataTable's getLegacyDataTableOptions when a dropdown/autocomplete column in the DataTable config names a model method that does not exist on the model class. The legacy options callback resolves per-column option methods, and the lookup for the column's declared method failed.","triggerScenarios":"Thrown at modules/backend/formwidgets/datatable/LegacyDataTable.php:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the declared method to the model class returning dropdown options","Correct the method name configured for that column in the datatable field config","Replace the legacy callback approach with the Table widget's native options resolution if migrating"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}