{"record":{"id":"fd5dbdf1623fe634","repo":"phalcon/cphalcon","slug":"cannot-use-models-of-different-database-systems-in","errorCode":null,"errorMessage":"Cannot use models of different database systems in the same query","messagePattern":"Cannot use models of different database systems in the same query","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Query\\Exceptions\\MixedDatabaseSystems","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":1135,"sourceCode":"                    intermediate,\n                    bindParams,\n                    bindTypes\n                );\n            } else {\n                let connection = this->getReadConnection(\n                    model,\n                    intermediate,\n                    bindParams,\n                    bindTypes\n                );\n            }\n\n            if typeof connection == \"object\" {\n                // More than one type of connection is not allowed\n                let connectionTypes[connection->getType()] = true;\n\n                if unlikely count(connectionTypes) == 2 {\n                    throw new MixedDatabaseSystems();\n                }\n            }\n        }\n\n        let columns = intermediate[\"columns\"];\n\n        let haveObjects = false,\n            haveScalars = false,\n            isComplex = false;\n\n        // Check if the resultset have objects and how many of them have\n        let numberObjects = 0;\n        let columns1 = columns;\n\n        for column in columns {\n            if unlikely typeof column != \"array\" {\n                throw new InvalidColumnDefinition();\n            }","sourceCodeStart":1117,"sourceCodeEnd":1153,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L1117-L1153","documentation":"Error \"Cannot use models of different database systems in the same query\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:1135 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"}