phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\MixedDatabaseSystems

Cannot use models of different database systems in the same

Error message

Cannot use models of different database systems in the same query

What it means

Error "Cannot use models of different database systems in the same query" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model/Query.zep:1135

                    intermediate,
                    bindParams,
                    bindTypes
                );
            } else {
                let connection = this->getReadConnection(
                    model,
                    intermediate,
                    bindParams,
                    bindTypes
                );
            }

            if typeof connection == "object" {
                // More than one type of connection is not allowed
                let connectionTypes[connection->getType()] = true;

                if unlikely count(connectionTypes) == 2 {
                    throw new MixedDatabaseSystems();
                }
            }
        }

        let columns = intermediate["columns"];

        let haveObjects = false,
            haveScalars = false,
            isComplex = false;

        // Check if the resultset have objects and how many of them have
        let numberObjects = 0;
        let columns1 = columns;

        for column in columns {
            if unlikely typeof column != "array" {
                throw new InvalidColumnDefinition();
            }

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:1135 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/fd5dbdf1623fe634. Report an issue: GitHub.