phalcon/cphalcon · error · NoPrimaryKey
Source related to this model does not have a primary key def
Error message
Source related to this model does not have a primary key defined
What it means
Error "Source related to this model does not have a primary key defined" thrown in phalcon/cphalcon.
Source
Thrown at phalcon/Mvc/Model/Query/Builder.zep:790
}
/**
* Use a named bind parameter instead of embedding the value
* directly in the PHQL string. Embedding produces a unique
* PHQL string per ID value, causing unbounded growth of the
* internal PHQL cache in long-running processes.
*/
let this->bindParams["APK0"] = conditions,
conditions = this->autoescape(model) . "." . this->autoescape(attributeField) . " = :APK0:",
noPrimary = false;
}
}
/**
* A primary key is mandatory in these cases
*/
if unlikely noPrimary {
throw new NoPrimaryKey();
}
}
let distinct = this->distinct;
if typeof distinct == "boolean" {
if distinct {
let phql = "SELECT DISTINCT ";
} else {
let phql = "SELECT ALL ";
}
} else {
let phql = "SELECT ";
}
let columns = this->columns;
if columns !== null {View on GitHub (pinned to b7419de9cd)
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Query/Builder.zep:790 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/5a978853dc1febc2.
Report an issue: GitHub.