{"record":{"id":"5a978853dc1febc2","repo":"phalcon/cphalcon","slug":"source-related-to-this-model-does-not-have-a-prima","errorCode":null,"errorMessage":"Source related to this model does not have a primary key defined","messagePattern":"Source related to this model does not have a primary key defined","errorType":"exception","errorClass":"NoPrimaryKey","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query/Builder.zep","lineNumber":790,"sourceCode":"                    }\n\n                    /**\n                     * Use a named bind parameter instead of embedding the value\n                     * directly in the PHQL string. Embedding produces a unique\n                     * PHQL string per ID value, causing unbounded growth of the\n                     * internal PHQL cache in long-running processes.\n                     */\n                    let this->bindParams[\"APK0\"] = conditions,\n                        conditions = this->autoescape(model) . \".\" . this->autoescape(attributeField) . \" = :APK0:\",\n                        noPrimary = false;\n                }\n            }\n\n            /**\n             * A primary key is mandatory in these cases\n             */\n            if unlikely noPrimary {\n                throw new NoPrimaryKey();\n            }\n        }\n\n        let distinct = this->distinct;\n\n        if typeof distinct == \"boolean\" {\n            if distinct {\n                let phql = \"SELECT DISTINCT \";\n            } else {\n                let phql = \"SELECT ALL \";\n            }\n        } else {\n            let phql = \"SELECT \";\n        }\n\n        let columns = this->columns;\n\n        if columns !== null {","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query/Builder.zep#L772-L808","documentation":"Error \"Source related to this model does not have a primary key defined\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query/Builder.zep:790 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-21T13:17:26.733Z"}