mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Missiong update on note in grid, but now you can create tags in the modal.. =)
This commit is contained in:
@@ -20,12 +20,27 @@ class TagMapper extends Mapper {
|
||||
return $this->findEntities($sql, [$userId]);
|
||||
}
|
||||
|
||||
public function getTagsForNote ($noteId) {
|
||||
public function getTagsForNote($userId, $noteId) {
|
||||
$sql = 'SELECT T.id, T.name FROM *PREFIX*quicknotes_tags T ';
|
||||
$sql.= 'INNER JOIN *PREFIX*quicknotes_note_tags NT ';
|
||||
$sql.= 'ON T.id = NT.tag_id ';
|
||||
$sql.= 'WHERE NT.note_id = ?';
|
||||
return $this->findEntities($sql, [$noteId]);
|
||||
$sql.= 'WHERE NT.user_id = ? AND NT.note_id = ?';
|
||||
return $this->findEntities($sql, [$userId, $noteId]);
|
||||
}
|
||||
|
||||
public function getTag($userId, $name) {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_tags WHERE user_id = ? AND name = ?';
|
||||
return $this->findEntity($sql, [$userId, $name]);
|
||||
}
|
||||
|
||||
public function tagExists($userId, $name) {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_tags WHERE user_id = ? AND name = ?';
|
||||
try {
|
||||
return $this->findEntities($sql, [$userId, $name]);
|
||||
} catch (DoesNotExistException $e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user