phalcon/cphalcon · error · NoModelForAlias

There is no model related to model or alias '{model}', when

Error message

There is no model related to model or alias '{model}', when executing: {phql}

What it means

Error "There is no model related to model or alias '{model}', when executing: {phql}" thrown in phalcon/cphalcon.

Source

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

            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);
                }

                let columnMap = metaData->getReverseColumnMap(model);
            } else {
                let columnMap = null;
            }

            if typeof columnMap == "array" {
                if unlikely !fetch realColumnName, columnMap[columnName] {
                    throw new ColumnNotInDomain(columnName, columnDomain, this->phql);
                }
            } else {
                let realColumnName = columnName;
            }
        } else {
            /**
             * If the column IR does not have a domain, we must check for
             * ambiguities

View on GitHub (pinned to b7419de9cd)

When it happens

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