Add database tables to tag notes

This commit is contained in:
Matias De lellis
2019-11-06 09:25:36 -03:00
parent 7cc02889f8
commit 8396e2a40a
6 changed files with 154 additions and 1 deletions

23
db/tagmapper.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
namespace OCA\QuickNotes\Db;
use OCP\IDBConnection;
use OCP\AppFramework\Db\Mapper;
class TagMapper extends Mapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'quicknotes_tags', '\OCA\QuickNotes\Db\Tag');
}
public function find($id, $userId) {
$sql = 'SELECT * FROM *PREFIX*quicknotes_tags WHERE id = ? AND user_id = ?';
return $this->findEntity($sql, [$id, $userId]);
}
public function findAll($userId) {
$sql = 'SELECT * FROM *PREFIX*quicknotes_tags WHERE user_id = ?';
return $this->findEntities($sql, [$userId]);
}
}