summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-09-13 11:17:02 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-09-13 11:17:02 -0400
commit008e565bed860e9f61dd9aaeefca74e003b42f8a (patch)
tree1f2a20c58c8e61c058a8859bcd07c9f665ac603f /lib
parent5c164090799ff96073915a9f21cf83038f828048 (diff)
small refactoring on the backend
Diffstat (limited to 'lib')
-rw-r--r--lib/feedmapper.php6
-rw-r--r--lib/foldermapper.php4
-rw-r--r--lib/itemmapper.php8
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php
index 85797c44c..16804a1a7 100644
--- a/lib/feedmapper.php
+++ b/lib/feedmapper.php
@@ -24,7 +24,9 @@ class FeedMapper {
if ($userid !== null) {
$this->userid = $userid;
}
- $this->userid = \OCP\USER::getUser();
+ else {
+ $this->userid = \OCP\USER::getUser();
+ }
}
/**
@@ -113,7 +115,7 @@ class FeedMapper {
$feed = self::fromRow($row);
$itemMapper = new ItemMapper();
- $items = $itemMapper->findAll($id);
+ $items = $itemMapper->findById($id);
$feed->setItems($items);
return $feed;
diff --git a/lib/foldermapper.php b/lib/foldermapper.php
index 28abad0e6..17fcbbf7b 100644
--- a/lib/foldermapper.php
+++ b/lib/foldermapper.php
@@ -25,7 +25,9 @@ class FolderMapper {
if ($userid !== null) {
$this->userid = $userid;
}
- $this->userid = \OCP\USER::getUser();
+ else {
+ $this->userid = \OCP\USER::getUser();
+ }
}
diff --git a/lib/itemmapper.php b/lib/itemmapper.php
index 1da04f8ef..41e4e3a29 100644
--- a/lib/itemmapper.php
+++ b/lib/itemmapper.php
@@ -25,7 +25,9 @@ class ItemMapper {
if ($userid !== null) {
$this->userid = $userid;
}
- $this->userid = \OCP\USER::getUser();
+ else {
+ $this->userid = \OCP\USER::getUser();
+ }
}
/**
@@ -51,7 +53,7 @@ class ItemMapper {
* @brief Retrieve all the item corresponding to a feed from the database
* @param feedid The id of the feed in the database table.
*/
- public function findAll($feedid) {
+ public function findByFeedId($feedid) {
$stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE feed_id = ? ORDER BY pub_date DESC');
$result = $stmt->execute(array($feedid));
@@ -233,7 +235,7 @@ class ItemMapper {
* @brief Retrieve an item from the database
* @param id The id of the feed in the database table.
*/
- public function find($id) {
+ public function findById($id) {
$stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();