Record Snapshots

i use this code to have snapshots

$user->username='ali';
$user->status='N';
$user->save();
$user->username='ali2';
var_dump($user->getChangedFields()); 
var_dump($user->hasChanged('username')); 
var_dump($user->hasChanged('status')); 

but i have this error : The record doesn't have a valid data snapshot' in phalcon/mvc/model.zep on line 3628

What do you get when you var_dump($user);

edited Apr '15
array (size=3)
  'id' => string '28' (length=2)
  'username' => string 'ali2' (length=4)
  'status' => string 'N' (length=1)

I think the snapshot is loaded when you do a find() to load a record. If you're just creating a record from scratch, then saving it - a snapshot doesn't get created.



48.2k

Perhaps models should setup snapshot data after an insert if it is turned on. Otherwise there are situations where one needs to retrieve it.