phalcon/cphalcon · error · UnknownModelOrAlias

Unknown model or alias '{model}' ({tag}), when preparing: {p

Error message

Unknown model or alias '{model}' ({tag}), when preparing: {phql}

What it means

Error "Unknown model or alias '{model}' ({tag}), when preparing: {phql}" thrown in phalcon/cphalcon.

Source

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

            return [
                "type": "qualified",
                "name": columnName
            ];
        }

        let metaData = this->metaData;

        /**
         * Check if the qualified name has a domain
         */
        if fetch columnDomain, expr["domain"] {
            let sqlAliases = this->sqlAliases;

            /**
             * The column has a domain, we need to check if it's an alias
             */
            if unlikely !fetch source, sqlAliases[columnDomain] {
                throw new UnknownModelOrAlias(columnDomain, "11", this->phql);
            }

            /**
             * Change the selected column by its real name on its mapped table
             */
            if Settings::get("orm.column_renaming") {
                /**
                 * Retrieve the corresponding model by its alias
                 */
                let sqlAliasesModelsInstances = this->sqlAliasesModelsInstances;

                /**
                 * We need the model instance to retrieve the reversed column
                 * map
                 */
                if unlikely !fetch model, sqlAliasesModelsInstances[columnDomain] {
                    throw new NoModelForAlias(columnDomain, this->phql);
                }

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:3207 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/a221793c96404efd. Report an issue: GitHub.