public function saveWithRevision() { $rev = $this->createRevision(); $ret = $this->save(); if ($ret->error) { throw $ret->toException("Can't save record."); } return $rev; }