{"record":{"id":"dfdb99986629c3c9","repo":"phalcon/cphalcon","slug":"column-name-does-not-belong-to-the-model-or-al","errorCode":null,"errorMessage":"Column '{name}' does not belong to the model or alias '{model}', when executing: {phql}","messagePattern":"Column '(.+?)' does not belong to the model or alias '(.+?)', when executing: (.+?)","errorType":"exception","errorClass":"ColumnNotInDomain","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":3234,"sourceCode":"                 */\n                let sqlAliasesModelsInstances = this->sqlAliasesModelsInstances;\n\n                /**\n                 * We need the model instance to retrieve the reversed column\n                 * map\n                 */\n                if unlikely !fetch model, sqlAliasesModelsInstances[columnDomain] {\n                    throw new NoModelForAlias(columnDomain, this->phql);\n                }\n\n                let columnMap = metaData->getReverseColumnMap(model);\n            } else {\n                let columnMap = null;\n            }\n\n            if typeof columnMap == \"array\" {\n                if unlikely !fetch realColumnName, columnMap[columnName] {\n                    throw new ColumnNotInDomain(columnName, columnDomain, this->phql);\n                }\n            } else {\n                let realColumnName = columnName;\n            }\n        } else {\n            /**\n             * If the column IR does not have a domain, we must check for\n             * ambiguities\n             */\n            let number = 0,\n                hasModel = false;\n\n            for model in this->modelsInstances {\n                /**\n                 * Check if the attribute belongs to the current model\n                 */\n                if metaData->hasAttribute(model, columnName) {\n                    let number++;","sourceCodeStart":3216,"sourceCodeEnd":3252,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L3216-L3252","documentation":"Error \"Column '{name}' does not belong to the model or alias '{model}', when executing: {phql}\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:3234 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"}