phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\SnapshotsDisabled
The 'keepSnapshots' option must be enabled to track changes…
Error message
The 'keepSnapshots' option must be enabled to track changes in '{className}' What it means
Thrown by Model::getChangedFields when the model has no snapshot array, because the 'keepSnapshots' option is not enabled for it. Enable keepSnapshots in the model's initialization (setKeepSnapshots(true)) to use change tracking.
Solutions
- Enable keepSnapshots on the model (keepSnapshots(true) in initialize()/configuration)
- Or track changes manually without getChangedFields()
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at phalcon/Mvc/Model.zep:2081 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/cd01f8a46af1a238.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model.zep:2081
* ```php
* $invoices = Invoices::findFirst();
* print_r($invoices->getChangedFields()); // []
*
* $invoices->deleted = 'Y';
*
* $invoices->getChangedFields();
* print_r($invoices->getChangedFields()); // ["deleted"]
* ```
*/
public function getChangedFields() -> array
{
var metaData, name, snapshot, columnMap, allAttributes, value;
array changed;
let snapshot = this->snapshot;
if unlikely typeof snapshot !== "array" {
throw new SnapshotsDisabled(get_class(this));
}
/**
* Return the models meta-data
*/
let metaData = this->getModelsMetaData();
/**
* The reversed column map is an array if the model has a column map
*/
let columnMap = metaData->getReverseColumnMap(this);
/**
* Data types are field indexed
*/
if typeof columnMap !== "array" {
let allAttributes = metaData->getDataTypes(this);
} else {View on GitHub (pinned to b7419de9cd)