Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Db
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2019-04-23 13:00:59 +0300
committerJulius Härtl <jus@bitgrid.net>2019-04-23 13:00:59 +0300
commit2660b7fee51fe87c375307891e4a8abb98c07a69 (patch)
tree0be402f081d029bdc6a82bd80e8df0b7add65ce6 /lib/Db
parent1bdb0ff3eaa0f8a874bbf306ca5fe8a45f8e6ff4 (diff)
Add first file handling
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/Document.php13
-rw-r--r--lib/Db/StepMapper.php8
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Db/Document.php b/lib/Db/Document.php
index 3155eac73..5c1e30c06 100644
--- a/lib/Db/Document.php
+++ b/lib/Db/Document.php
@@ -26,18 +26,29 @@ namespace OCA\Text\Db;
use OCP\AppFramework\Db\Entity;
-class Document extends Entity {
+class Document extends Entity implements \JsonSerializable {
public $id;
protected $currentVersion = 0;
protected $lastSavedVersion = 0;
protected $initialVersion = 0;
+ protected $lastSavedVersionTime = 0;
public function __construct() {
$this->addType('id', 'integer');
$this->addType('currentVersion', 'integer');
$this->addType('lastSavedVersion', 'integer');
+ $this->addType('lastSavedVersionTime', 'integer');
$this->addType('initialVersion', 'integer');
}
+ public function jsonSerialize() {
+ return [
+ 'id' => $this->id,
+ 'currentVersion' => $this->currentVersion,
+ 'lastSavedVersion' => $this->lastSavedVersion,
+ 'lastSavedVersionTime' => $this->lastSavedVersionTime,
+ ];
+ }
+
}
diff --git a/lib/Db/StepMapper.php b/lib/Db/StepMapper.php
index d8b370592..847409750 100644
--- a/lib/Db/StepMapper.php
+++ b/lib/Db/StepMapper.php
@@ -45,4 +45,12 @@ class StepMapper extends QBMapper {
return $this->findEntities($qb);
}
+
+ public function deleteAll($documentId) {
+ /* @var $qb IQueryBuilder */
+ $qb = $this->db->getQueryBuilder();
+ $qb->delete($this->getTableName())
+ ->where($qb->expr()->eq('document_id', $qb->createNamedParameter($documentId)))
+ ->execute();
+ }
}