{"record":{"id":"202d77e9a661e712","repo":"octobercms/october","slug":"to-display-list-as-a-tree-the-model-modelclass","errorCode":null,"errorMessage":"To display list as a tree, the model {$modelClass} must implement methods found in October\\Contracts\\Database\\TreeInterface, or set showTree to false","messagePattern":"To display list as a tree, the model (.+?) must implement methods found in October\\\\Contracts\\\\Database\\\\TreeInterface, or set showTree to false","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/widgets/ListStructure.php","lineNumber":327,"sourceCode":"        }\n\n        foreach ($records as $record) {\n            if ($record->getChildCount()) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    /**\n     * validateTree validates the model and settings if useStructure is used\n     */\n    public function validateTree()\n    {\n        if (!$this->model->isClassInstanceOf(\\October\\Contracts\\Database\\TreeInterface::class)) {\n            $modelClass = get_class($this->model);\n            throw new ApplicationException(\n                \"To display list as a tree, the model {$modelClass} must implement methods found in October\\Contracts\\Database\\TreeInterface, or set showTree to false\"\n            );\n        }\n    }\n\n    /**\n     * useSortOrdering\n     */\n    public function useSortOrdering(): bool\n    {\n        return $this->includeSortOrders || $this->model->isClassInstanceOf(\\October\\Contracts\\Database\\SortableInterface::class);\n    }\n\n    /**\n     * onReorder\n     */\n    public function onReorder()\n    {","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/widgets/ListStructure.php#L309-L345","documentation":"Error \"To display list as a tree, the model {$modelClass} must implement methods found in October\\Contracts\\Database\\TreeInterface, or set showTree to false\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/widgets/ListStructure.php:327 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"}