private function getRevisionId() { if ($this->revisionId === null) { $date = date_create("now")->format($this->platform->getDateTimeFormatString()); if ($this->config->getCurrentUser() != null) { $userId = $this->config->getCurrentUser()->getId(); } else { $userId = null; } $this->conn->insert($this->config->getRevisionTableName(), array('timestamp' => $date, 'user_id' => $userId, 'note' => $this->config->getNote(), 'ipaddress' => $this->config->getIpAddress())); $sequenceName = $this->platform->supportsSequences() ? 'REVISIONS_ID_SEQ' : null; $this->revisionId = $this->conn->lastInsertId($sequenceName); } return $this->revisionId; }
/** * Shrani array sprememb entitet v bazo * * @param array $changes */ protected function saveChanges($changes) { $sql = "INSERT INTO {$this->tableName} (razred, objectId, upor, datum, tip, data)\n VALUES (?, ?, ?, ?, ?, ?)"; $stmt = $this->conn->prepare($sql); $date = date_create("now")->format($this->platform->getDateTimeFormatString()); $user = $this->identity ? $this->identity->getId() : null; foreach ($changes as $objectId => $change) { $class = get_class($change['entity']); $type = $change['type']; $data = serialize($change['data']); $stmt->bindValue(1, $class, \PDO::PARAM_STR); $stmt->bindValue(2, $objectId, \PDO::PARAM_STR); $stmt->bindValue(3, $user, \PDO::PARAM_STR); $stmt->bindValue(4, $date, \PDO::PARAM_STR); $stmt->bindValue(5, $type, \PDO::PARAM_STR); $stmt->bindValue(6, $data, \PDO::PARAM_STR); $stmt->execute(); } }