{"record":{"id":"945b397938dd5176","repo":"phalcon/cphalcon","slug":"cannot-delete-the-record-because-the-primary-key-a","errorCode":null,"errorMessage":"Cannot delete the record because the primary key attribute: '{attribute}' was not set in '{className}'","messagePattern":"Cannot delete the record because the primary key attribute: '(.+?)' was not set in '(.+?)'","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\PrimaryKeyAttributeNotSet","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model.zep","lineNumber":1577,"sourceCode":"            }\n\n            /**\n             * Take the column values based on the column map if any\n             */\n            if typeof columnMap == \"array\" {\n                if unlikely !fetch attributeField, columnMap[primaryKey] {\n                    throw new ColumnNotInTableMap(primaryKey, get_class(this));\n                }\n            } else {\n                let attributeField = primaryKey;\n            }\n\n            /**\n             * If the attribute is currently set in the object add it to the\n             * conditions\n             */\n            if unlikely !fetch value, this->{attributeField} {\n                throw new PrimaryKeyAttributeNotSet(attributeField, get_class(this));\n            }\n\n            /**\n             * Escape the column identifier\n             */\n            let values[] = value,\n                conditions[] = writeConnection->escapeIdentifier(primaryKey) . \" = ?\",\n                bindTypes[] = bindType;\n        }\n\n        if Settings::get(\"orm.events\") {\n            let this->skipped = false;\n\n            /**\n             * Fire the beforeDelete event\n             */\n            if this->fireEventCancel(\"beforeDelete\") === false {\n                return false;","sourceCodeStart":1559,"sourceCodeEnd":1595,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model.zep#L1559-L1595","documentation":"Error \"Cannot delete the record because the primary key attribute: '{attribute}' was not set in '{className}'\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model.zep:1577 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}