Pimcore\Model\Staticroute\Dao::save PHP Метод

save() публичный Метод

public save ( )
    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 = ["id", "name", "pattern", "reverse", "module", "controller", "action", "variables", "defaults", "siteId", "priority", "creationDate", "modificationDate"];
            foreach ($dataRaw as $key => $value) {
                if (in_array($key, $allowedProperties)) {
                    $data[$key] = $value;
                }
            }
            $this->db->insertOrUpdate($data, $this->model->getId());
        } catch (\Exception $e) {
            throw $e;
        }
        if (!$this->model->getId()) {
            $this->model->setId($this->db->getLastInsertId());
        }
    }