{"record":{"id":"f492c0a595d7a080","repo":"phalcon/cphalcon","slug":"the-updatesnapshotonsave-option-must-be-enabled","errorCode":null,"errorMessage":"The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '{className}'","messagePattern":"The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '(.+?)'","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\UpdateSnapshotDisabled","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model.zep","lineNumber":2448,"sourceCode":"     * $invoices->deleted = 'Y';\n     *\n     * $invoices->getChangedFields();\n     * print_r($invoices->getChangedFields()); // [\"deleted\"]\n     * $invoices->save();\n     * print_r($invoices->getChangedFields()); // []\n     * print_r($invoices->getUpdatedFields()); // [\"deleted\"]\n     * ```\n     */\n    public function getUpdatedFields() -> array\n    {\n        var name, snapshot, oldSnapshot, value;\n        array updated;\n\n        let snapshot = this->snapshot;\n        let oldSnapshot = this->oldSnapshot;\n\n        if unlikely !Settings::get(\"orm.update_snapshot_on_save\") {\n            throw new UpdateSnapshotDisabled(get_class(this));\n        }\n\n        if unlikely typeof snapshot != \"array\" {\n            throw new SnapshotsDisabled(get_class(this));\n        }\n\n        /**\n         * Dirty state must be DIRTY_PERSISTENT to make the checking\n         */\n        if unlikely this->dirtyState != self::DIRTY_STATE_PERSISTENT {\n            throw new RecordNotPersisted(get_class(this));\n        }\n\n        let updated = [];\n\n        for name, value in snapshot {\n            /**\n             * If some attribute is not present in the oldSnapshot, we assume","sourceCodeStart":2430,"sourceCodeEnd":2466,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model.zep#L2430-L2466","documentation":"Error \"The 'updateSnapshotOnSave' option must be enabled for this method to work properly in '{className}'\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model.zep:2448 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"}