1
0
mirror of https://github.com/moparisthebest/wallabag synced 2025-02-22 13:51:47 -05:00

[add] method code for get bookmarks

This commit is contained in:
Nicolas Lœuillet 2014-01-13 22:15:05 +01:00
parent 024e003943
commit 9d0b1712be
2 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,10 @@ class EntryApi
return $this->entryRepository->getEntries($status); return $this->entryRepository->getEntries($status);
} }
public function getBookmarks() {
return $this->entryRepository->getBookmarks();
}
public function getEntryById($id) { public function getEntryById($id) {
return $this->entryRepository->getEntryById($id); return $this->entryRepository->getEntryById($id);
} }

View File

@ -18,6 +18,14 @@ class EntryRepository
return $entries ? $entries : array(); return $entries ? $entries : array();
} }
//TODO don't hardcode the user ;)
public function getBookmarks($userId = 1) {
$sql = "SELECT * FROM entries where user_id = ? AND bookmark = 1 ORDER BY id DESC";
$entries = $this->db->fetchAll($sql, array($userId));
return $entries ? $entries : array();
}
//TODO don't hardcode the user ;) //TODO don't hardcode the user ;)
public function saveEntry($entry, $userId = 1) { public function saveEntry($entry, $userId = 1) {