/**
* Method to check if you can save a new or existing record.
*
* Extended classes can override this if necessary.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowSave($data, $key = 'id')
{
$recordId = $data[$key] ?? '0';
if ($recordId) {
return $this->allowEdit($data, $key);
} else {
return $this->allowAdd($data);
}
}