How I can set a snapshot of a new model? I tried this:
public function initialize()
{
$this->keepSnapshots(true);
$this->useDynamicUpdate(true);
$this->setSnapshotData([
'field1' => $this->field1,
...
]);
}
But I just get Change checking cannot be performed because the object has not been persisted or is deleted
when I do $this->hasChanged("field1")
in validation()
event.
I remark that, as a new model, its values are initially NULL
, so I think that the problem is that. I also tried with ""
, but is the same.