return $this;
} /**
* This method is called on save to determine if entry have to be updated
* If this method return false insert operation will be executed
*
* @param array|object $data Data
*/
protected function shouldUpdate($data): bool
{ if (parent::
shouldUpdate($data) === false
) { return false;
} if ($this->useAutoIncrement === true
) { return true;
} // When useAutoIncrement feature is disabled, check
// in the database if given record already exists
return $this->
where($this->primaryKey,
$this->
getIdValue($data))->
countAllResults() === 1;
}