{"record":{"id":"0de24ca857bf788c","repo":"octobercms/october","slug":"the-model-class-model-must-define-a-method-metho-0de24c","errorCode":null,"errorMessage":"The model class :model must define a method :method() returning options for the ':field' form field.","messagePattern":"The model class :model must define a method :method\\(\\) returning options for the ':field' form field\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/classes/FormField.php","lineNumber":545,"sourceCode":"     * getOptionsFromModelAsString where options are an explicit method reference\n     */\n    protected function getOptionsFromModelAsString($model, string $methodName, $data)\n    {\n        // Calling via ClassName::method\n        if ($callableMethod = $this->getCallableMethodFromValue($methodName)) {\n            $fieldOptions = $callableMethod($model, $this);\n\n            if (!is_array($fieldOptions)) {\n                throw new SystemException(Lang::get('backend::lang.field.options_static_method_invalid_value', [\n                    'class' => $callableMethod[0],\n                    'method' => $callableMethod[1]\n                ]));\n            }\n        }\n        // Calling via $model->method\n        else {\n            if (!$this->objectMethodExists($model, $methodName)) {\n                throw new SystemException(Lang::get('backend::lang.field.options_method_not_exists', [\n                    'model' => get_class($model),\n                    'method' => $methodName,\n                    'field' => $this->fieldName\n                ]));\n            }\n\n            $fieldOptions = $model->$methodName($this->value, $this->fieldName, $data);\n        }\n\n        return $fieldOptions;\n    }\n\n    /**\n     * getOptionsFromModelAsDefault refers to the model method or any of its behaviors\n     */\n    protected function getOptionsFromModelAsDefault($model, $data)\n    {\n        try {","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/classes/FormField.php#L527-L563","documentation":"Error \"The model class :model must define a method :method() returning options for the ':field' form field.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/classes/FormField.php:545 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":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}