phalcon/cphalcon · error · ColumnNotInDomain

Column '{name}' does not belong to the model or alias '{mode

Error message

Column '{name}' does not belong to the model or alias '{model}', when executing: {phql}

What it means

Error "Column '{name}' does not belong to the model or alias '{model}', when executing: {phql}" thrown in phalcon/cphalcon.

Source

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

                 */
                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
             */
            let number = 0,
                hasModel = false;

            for model in this->modelsInstances {
                /**
                 * Check if the attribute belongs to the current model
                 */
                if metaData->hasAttribute(model, columnName) {
                    let number++;

View on GitHub (pinned to b7419de9cd)

When it happens

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