Pimcore\Model\Tool\Email\Log\Dao::save PHP Метод

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

Save document to database
public save ( ) : void
Результат void
    public function save()
    {
        $data = [];
        $emailLog = get_object_vars($this->model);
        foreach ($emailLog as $key => $value) {
            if (in_array($key, $this->getValidTableColumns(self::$dbTable))) {
                // check if the getter exists
                $getter = "get" . ucfirst($key);
                if (!method_exists($this->model, $getter)) {
                    continue;
                }
                // get the value from the getter
                $value = $this->model->{$getter}();
                if (is_bool($value)) {
                    $value = (int) $value;
                } elseif (is_array($value)) {
                    //converts the dynamic params to a basic json string
                    $preparedData = self::createJsonLoggingObject($value);
                    $value = \Zend_Json::encode($preparedData);
                }
                $data[$key] = $value;
            }
        }
        try {
            $this->db->update(self::$dbTable, $data, $this->db->quoteInto("id = ?", $this->model->getId()));
        } catch (\Exception $e) {
            Logger::emerg('Could not Save emailLog with the id "' . $this->model->getId() . '" ');
        }
    }