{"record":{"id":"59916ec7b53bbebb","repo":"phalcon/cphalcon","slug":"model-modelname-does-not-define-a-relation-wit","errorCode":null,"errorMessage":"Model '{modelName}' does not define a relation with alias '{alias}'","messagePattern":"Model '(.+?)' does not define a relation with alias '(.+?)'","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\UnknownEagerRelation","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Eager/Loader.zep","lineNumber":163,"sourceCode":"     *\n     * @param array $parents attribute-keyed row arrays at the root, or\n     *                       ModelInterface / Row instances below it\n     */\n    protected function buildMap(\n        array parents,\n        string modelName,\n        array tree\n    ) -> array {\n        var alias, node, relation;\n        array map;\n\n        let map = [];\n\n        for alias, node in tree {\n            let relation = this->manager->getRelationByAlias(modelName, alias);\n\n            if unlikely typeof relation !== \"object\" {\n                throw new UnknownEagerRelation(modelName, alias);\n            }\n\n            let map[strtolower(alias)] = this->buildNode(\n                relation,\n                alias,\n                parents,\n                node\n            );\n        }\n\n        return map;\n    }\n\n    /**\n     * Builds a single map node: one query, indexed by the referenced field.\n     */\n    protected function buildNode(\n        <RelationInterface> relation,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Eager/Loader.zep#L145-L181","documentation":"Error \"Model '{modelName}' does not define a relation with alias '{alias}'\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Eager/Loader.zep:163 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":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}