phalcon/cphalcon · error · Phalcon\Paginator\Exceptions\BuilderModelNotDefined
Model not defined in builder
Error message
Model not defined in builder
What it means
Error "Model not defined in builder" thrown in phalcon/cphalcon.
Source
Thrown at phalcon/Paginator/Adapter/QueryBuilder.zep:275
* Remove the 'ORDER BY' clause, PostgreSQL requires this
*/
totalBuilder->orderBy(null);
/**
* Obtain the PHQL for the total query
*/
let totalQuery = totalBuilder->getQuery();
/**
* Obtain the result of the total query
* If we have having perform native count on temp table
*/
if hasHaving || hasMultipleGroups {
let sql = totalQuery->getSql(),
modelClass = builder->getModels();
if unlikely modelClass === null {
throw new BuilderModelNotDefined();
}
if typeof modelClass == "array" {
let modelClass = array_values(modelClass)[0];
}
let model = create_instance(modelClass),
dbService = model->getReadConnectionService(),
db = totalBuilder->getDI()->get(dbService);
let row = db->fetchOne(
"SELECT COUNT(*) as \"rowcount\" FROM (" . sql["sql"] . ") as T1",
Enum::FETCH_ASSOC,
sql["bind"]
);
let rowcount = row ? intval(row["rowcount"]) : 0,
totalPages = intval(ceil(rowcount / limit));View on GitHub (pinned to b7419de9cd)
When it happens
Trigger: Thrown at phalcon/Paginator/Adapter/QueryBuilder.zep:275 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/1ab9fc8264646f14.
Report an issue: GitHub.