phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\PhqlColumnNotInMap
Column ' ' isn't part of the column map
Error message
Column '{fieldName}' isn't part of the column map What it means
In prepareInsert(), when column renaming (orm.column_renaming) is active and no explicit field list is given, each field must exist in the model's column map; an unknown field name raises this PhqlColumnDoesNotExist-style error. The faulty input is a column name in the INSERT that is neither an attribute nor present in columnMap().
Solutions
- Use the model attribute name, not the physical column name, in the PHQL INSERT
- Add the missing entry to the model's columnMap()
- Disable column renaming or align naming conventions
Example fix
INSERT INTO Robots (theName) VALUES (:name:) -- where columnMap maps 'theName'
Defensive patterns
Strategy: validation
Prevention
- Reference attributes via model constants or builder columns()
- Keep columnMap() complete and generated from the schema
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query.zep:1056 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/f08df134ab0c2b3c.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Query.zep:1056
break;
default:
let insertValue = new RawValue(
dialect->getSqlExpression(exprValue)
);
break;
}
let fieldName = fields[number];
/**
* If the user didn't define a column list we assume all the model's
* attributes as columns
*/
if automaticFields && typeof columnMap == "array" {
if unlikely !fetch attributeName, columnMap[fieldName] {
throw new PhqlColumnNotInMap(fieldName);
}
} else {
let attributeName = fieldName;
}
let insertValues[attributeName] = insertValue;
}
/**
* Get model from the Models Manager
*/
let insertModel = manager->load(modelName);
insertModel->assign(insertValues);
/**
* Call 'create' to ensure that an insert is performed
* Return the insert statusView on GitHub (pinned to b7419de9cd)