diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-10-28 19:26:59 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-10-28 19:26:59 -0400 |
commit | 4299b35e82480271edf39b4f2a0831b7e0a68970 (patch) | |
tree | 6ce62d64e01150edda9141b4c1c050a5ef5ebf1f /lib | |
parent | a7f7f04052ded38c94e15a4e94645f6ab2b39941 (diff) |
[News] fix bugs in feedById
Diffstat (limited to 'lib')
-rw-r--r-- | lib/itemmapper.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/itemmapper.php b/lib/itemmapper.php index ba9be41a7..9b6c613ff 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -36,6 +36,7 @@ class ItemMapper { * @returns an object of the class OC_News_Item */ public function fromRow($row) { + $url = $row['url']; $title = $row['title']; $guid = $row['guid']; @@ -171,8 +172,10 @@ class ItemMapper { $status, $itemid ); - $stmt->execute($params); + + $result = $stmt->execute($params); + return true; } @@ -239,11 +242,18 @@ class ItemMapper { * @param id The id of the item in the database table. */ public function findById($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)); + $stmt = \OCP\DB::prepare('SELECT ' . self::tableName . '.id AS id, ' . self::tableName . + '.url AS url, ' . self::tableName . '.title AS title, guid, body, status, author, feed_id, pub_date' . + ' 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)); + + /* + $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?'); + $result = $stmt->execute(array($id)); + */ $row = $result->fetchRow(); $item = $this->fromRow($row); |