public function save()
{
$data = $this->model->getData();
if ($this->model->getType() == "object" || $this->model->getType() == "asset" || $this->model->getType() == "document") {
if ($data instanceof Model\Element\ElementInterface) {
$data = $data->getId();
} else {
$data = null;
}
}
if (is_array($data) || is_object($data)) {
$data = \Pimcore\Tool\Serialize::serialize($data);
}
$saveData = ["cid" => $this->model->getCid(), "ctype" => $this->model->getCtype(), "cpath" => $this->model->getCpath(), "name" => $this->model->getName(), "type" => $this->model->getType(), "inheritable" => (int) $this->model->getInheritable(), "data" => $data];
$this->db->insertOrUpdate("properties", $saveData);
}