{"record":{"id":"13c1d6d72113951f","repo":"octobercms/october","slug":"model-class-does-not-contain-a-definition-for","errorCode":null,"errorMessage":"Model ':class' does not contain a definition for ':relation'.","messagePattern":"Model ':class' does not contain a definition for ':relation'\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/traits/FormModelWidget.php","lineNumber":30,"sourceCode":" * @package october\\backend\n * @author Alexey Bobkov, Samuel Georges\n */\ntrait FormModelWidget\n{\n    /**\n     * Returns the final model and attribute name of\n     * a nested HTML array attribute.\n     * Eg: [$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);\n     * @param  string $attribute.\n     * @return array\n     */\n    public function resolveModelAttribute($attribute)\n    {\n        try {\n            return $this->formField->resolveModelAttribute($this->model, $attribute);\n        }\n        catch (Exception $ex) {\n            throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [\n                'class' => get_class($this->model),\n                'relation' => $attribute\n            ]));\n        }\n    }\n\n    /**\n     * nearestModelAttribute\n     */\n    public function nearestModelAttribute($attribute)\n    {\n        return $this->formField->nearestModelAttribute($this->model, $attribute);\n    }\n\n    /**\n     * Returns the model of a relation type,\n     * supports nesting via HTML array.\n     * @return Relation","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/traits/FormModelWidget.php#L12-L48","documentation":"Error \"Model ':class' does not contain a definition for ':relation'.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/traits/FormModelWidget.php:30 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"}