{"record":{"id":"2b16592d6ddd66de","repo":"phalcon/cphalcon","slug":"eager-loading-the-relation-alias-requires-the","errorCode":null,"errorMessage":"Eager loading the relation '{alias}' requires the column '{column}' to be present in the selected columns","messagePattern":"Eager loading the relation '(.+?)' requires the column '(.+?)' to be present in the selected columns","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\MissingEagerKeyColumn","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Eager/Loader.zep","lineNumber":475,"sourceCode":"    protected function collectKeys(\n        array parents,\n        array fields,\n        string alias\n    ) -> array {\n        var field, parent, value;\n        array seen, values;\n\n        let seen = [];\n\n        for parent in parents {\n            let values = [];\n\n            for field in fields {\n                if typeof parent === \"object\" {\n                    let value = parent->readAttribute(field);\n                } else {\n                    if unlikely !array_key_exists(field, parent) {\n                        throw new MissingEagerKeyColumn(alias, field);\n                    }\n\n                    let value = parent[field];\n                }\n\n                let values[] = value;\n            }\n\n            if in_array(null, values, true) {\n                continue;\n            }\n\n            let seen[self::buildKey(values)] = values;\n        }\n\n        return array_values(seen);\n    }\n","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Eager/Loader.zep#L457-L493","documentation":"Error \"Eager loading the relation '{alias}' requires the column '{column}' to be present in the selected columns\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Eager/Loader.zep:475 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"}