diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-11 17:59:43 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-08-11 17:59:43 -0400 |
commit | fcaa16f2eafe87e0353d1be7ce4bde0d33c43e81 (patch) | |
tree | 88b7f857f2295617945840281776bc9ec7e6f2dc | |
parent | 0913349b9db612d57a25472ce4e4d58dbf1f2898 (diff) |
adds a function to the item mapper to retrieve all items with a certain status
-rw-r--r-- | lib/itemmapper.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/itemmapper.php b/lib/itemmapper.php index 9ecfa8fc6..40693071f 100644 --- a/lib/itemmapper.php +++ b/lib/itemmapper.php @@ -54,6 +54,26 @@ class ItemMapper { return $items; } + + /** + * @brief Retrieve all the items corresponding to a feed from the database with a particular status + * @param feedid The id of the feed in the database table. + * @param status one of the constants defined in OCA\News\StatusFlag + */ + public function findAllStatus($feedid, $status){ + $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' + WHERE feed_id = ? + AND (status & ?)'); + $result = $stmt->execute(array($feedid, $status)); + + $items = array(); + while ($row = $result->fetchRow()) { + $item = $this->fromRow($row); + $items[] = $item; + } + + return $items; + } public function findIdFromGuid($guid, $feedid){ $stmt = \OCP\DB::prepare(' |