phalcon/cphalcon · error · ModelRequired
At least one model is required to build the query
Error message
At least one model is required to build the query
What it means
Error "At least one model is required to build the query" thrown in phalcon/cphalcon.
Source
Thrown at phalcon/Mvc/Model/Query/Builder.zep:714
var container, models, conditions, model, metaData, modelInstance,
primaryKeys, firstPrimaryKey, columnMap, modelAlias,
attributeField, phql, column, columns, selectedColumns,
selectedColumn, selectedModel, selectedModels, columnAlias,
modelColumnAlias, joins, join, joinModel, joinConditions,
joinAlias, joinType, group, groupItems, groupItem, having, order,
orderItems, orderItem, limit, number, offset, forUpdate, distinct;
bool noPrimary;
let container = this->container;
if typeof container != "object" {
let container = Di::getDefault(),
this->container = container;
}
let models = this->models;
if typeof models == "array" {
if unlikely empty models {
throw new ModelRequired();
}
} else {
if unlikely !models {
throw new ModelRequired();
}
}
let conditions = this->conditions;
if is_numeric(conditions) {
/**
* If the conditions is a single numeric field. We internally create
* a condition using the related primary key
*/
if typeof models == "array" {
if unlikely count(models) > 1 {
throw new BuilderConditionInvalid();
}View on GitHub (pinned to b7419de9cd)
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query/Builder.zep:714 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/f1f1db7144c99ccf.
Report an issue: GitHub.