public function save()
{
$ts = time();
if (!$this->model->getCreationDate()) {
$this->model->setCreationDate($ts);
}
$this->model->setModificationDate($ts);
try {
$dataRaw = get_object_vars($this->model);
$data = [];
$allowedProperties = ["name", "sql", "dataSourceConfig", "columnConfiguration", "niceName", "group", "xAxis", "groupIconClass", "iconClass", "reportClass", "creationDate", "modificationDate", "menuShortcut", "chartType", "pieColumn", "pieLabelColumn", "yAxis"];
foreach ($dataRaw as $key => $value) {
if (in_array($key, $allowedProperties)) {
$data[$key] = $value;
}
}
$this->db->insertOrUpdate($data, $this->model->getName());
} catch (\Exception $e) {
throw $e;
}
}