Pimcore\Model\Document\PrintAbstract\Dao::update PHP Method

update() public method

Updates the data in the object to the database
public update ( ) : void
return void
    public function update()
    {
        try {
            $this->model->setModificationDate(time());
            $document = get_object_vars($this->model);
            foreach ($document as $key => $value) {
                // check if the getter exists
                $getter = "get" . ucfirst($key);
                if (!method_exists($this->model, $getter)) {
                    continue;
                }
                // get the value from the getter
                if (in_array($key, $this->getValidTableColumns("documents")) || in_array($key, $this->validColumnsPage)) {
                    $value = $this->model->{$getter}();
                } else {
                    continue;
                }
                if (is_bool($value)) {
                    $value = (int) $value;
                }
                if (in_array($key, $this->getValidTableColumns("documents"))) {
                    $dataDocument[$key] = $value;
                }
                if (in_array($key, $this->validColumnsPage)) {
                    $dataPage[$key] = $value;
                }
            }
            $this->db->insertOrUpdate("documents", $dataDocument);
            $this->db->insertOrUpdate("documents_printpage", $dataPage);
            $this->updateLocks();
        } catch (\Exception $e) {
            throw $e;
        }
    }