summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-08-11 17:59:43 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-08-11 17:59:43 -0400
commitfcaa16f2eafe87e0353d1be7ce4bde0d33c43e81 (patch)
tree88b7f857f2295617945840281776bc9ec7e6f2dc /lib
parent0913349b9db612d57a25472ce4e4d58dbf1f2898 (diff)
adds a function to the item mapper to retrieve all items with a certain status
Diffstat (limited to 'lib')
-rw-r--r--lib/itemmapper.php20
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('