{"record":{"id":"b3e9e0392a618815","repo":"phalcon/cphalcon","slug":"cannot-obtain-the-model-s-source-from-the-models-l","errorCode":null,"errorMessage":"Cannot obtain the model's source from the models list: '{name}', when preparing: {phql}","messagePattern":"Cannot obtain the model's source from the models list: '(.+?)', when preparing: (.+?)","errorType":"exception","errorClass":"ModelSourceNotFound","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":3285,"sourceCode":"                throw new ColumnNotInSelectedModels(columnName, \"1\", this->phql);\n            }\n\n            /**\n             * Check if the models property is correctly prepared\n             */\n            let models = this->models;\n\n            if unlikely typeof models != \"array\" {\n                throw new ModelsListNotLoaded();\n            }\n\n            /**\n             * Obtain the model's source from the models list\n             */\n            let className = get_class(hasModel);\n\n            if unlikely !fetch source, models[className] {\n                throw new ModelSourceNotFound(className, this->phql);\n            }\n\n            /**\n             * Rename the column\n             */\n            if Settings::get(\"orm.column_renaming\") {\n                let columnMap = metaData->getReverseColumnMap(hasModel);\n            } else {\n                let columnMap = null;\n            }\n\n            if typeof columnMap == \"array\" {\n                /**\n                 * The real column name is in the column map\n                 */\n                if unlikely !fetch realColumnName, columnMap[columnName] {\n                    throw new ColumnNotInSelectedModels(columnName, \"3\", this->phql);\n                }","sourceCodeStart":3267,"sourceCodeEnd":3303,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L3267-L3303","documentation":"Error \"Cannot obtain the model's source from the models list: '{name}', when preparing: {phql}\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:3285 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"}