summaryrefslogtreecommitdiffstats
path: root/db/itemmapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'db/itemmapper.php')
-rw-r--r--db/itemmapper.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php
index dec80894f..a41ecfd66 100644
--- a/db/itemmapper.php
+++ b/db/itemmapper.php
@@ -172,6 +172,16 @@ class ItemMapper extends NewsMapper {
}
+ private function findEntitiesIgnoringNegativeLimit($sql, $params, $limit) {
+ // ignore limit if negative to offer a way to return all feeds
+ if ($limit >= 0) {
+ return $this->findEntities($sql, $params, $limit);
+ } else {
+ return $this->findEntities($sql, $params);
+ }
+ }
+
+
public function findAllFeed($id, $limit, $offset, $status, $oldestFirst,
$userId){
$params = [$userId, $id];
@@ -182,7 +192,7 @@ class ItemMapper extends NewsMapper {
$params[] = $offset;
}
$sql = $this->makeSelectQueryStatus($sql, $status, $oldestFirst);
- return $this->findEntities($sql, $params, $limit);
+ return $this->findEntitiesIgnoringNegativeLimit($sql, $params, $limit);
}
@@ -196,7 +206,7 @@ class ItemMapper extends NewsMapper {
$params[] = $offset;
}
$sql = $this->makeSelectQueryStatus($sql, $status, $oldestFirst);
- return $this->findEntities($sql, $params, $limit);
+ return $this->findEntitiesIgnoringNegativeLimit($sql, $params, $limit);
}
@@ -209,7 +219,8 @@ class ItemMapper extends NewsMapper {
$params[] = $offset;
}
$sql = $this->makeSelectQueryStatus($sql, $status, $oldestFirst);
- return $this->findEntities($sql, $params, $limit);
+
+ return $this->findEntitiesIgnoringNegativeLimit($sql, $params, $limit);
}