summaryrefslogtreecommitdiffstats
path: root/lib/itemmapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/itemmapper.php')
-rw-r--r--lib/itemmapper.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/itemmapper.php b/lib/itemmapper.php
index 92a3928d7..ba9be41a7 100644
--- a/lib/itemmapper.php
+++ b/lib/itemmapper.php
@@ -236,11 +236,14 @@ class ItemMapper {
/**
* @brief Retrieve an item from the database
- * @param id The id of the feed in the database table.
+ * @param id The id of the item in the database table.
*/
public function findById($id) {
- $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
- $result = $stmt->execute(array($id));
+ $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' JOIN ' . FeedMapper::tableName .
+ ' ON ' . self::tableName . '.feed_id = ' . FeedMapper::tableName . '.id WHERE '
+ . self::tableName .'.id = ? AND ' . FeedMapper::tableName . '.user_id = ? ');
+ $result = $stmt->execute(array($id, $this->userid));
+
$row = $result->fetchRow();
$item = $this->fromRow($row);