phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\PrimaryKeyAttributeNotSet
Cannot delete the record because the primary key attribute:
Error message
Cannot delete the record because the primary key attribute: '{attribute}' was not set in '{className}' What it means
Error "Cannot delete the record because the primary key attribute: '{attribute}' was not set in '{className}'" thrown in phalcon/cphalcon.
Source
Thrown at phalcon/Mvc/Model.zep:1577
}
/**
* Take the column values based on the column map if any
*/
if typeof columnMap == "array" {
if unlikely !fetch attributeField, columnMap[primaryKey] {
throw new ColumnNotInTableMap(primaryKey, get_class(this));
}
} else {
let attributeField = primaryKey;
}
/**
* If the attribute is currently set in the object add it to the
* conditions
*/
if unlikely !fetch value, this->{attributeField} {
throw new PrimaryKeyAttributeNotSet(attributeField, get_class(this));
}
/**
* Escape the column identifier
*/
let values[] = value,
conditions[] = writeConnection->escapeIdentifier(primaryKey) . " = ?",
bindTypes[] = bindType;
}
if Settings::get("orm.events") {
let this->skipped = false;
/**
* Fire the beforeDelete event
*/
if this->fireEventCancel("beforeDelete") === false {
return false;View on GitHub (pinned to b7419de9cd)
When it happens
Trigger: Thrown at phalcon/Mvc/Model.zep:1577 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/945b397938dd5176.
Report an issue: GitHub.