aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-04-17 10:57:35 +0200
committerGravatar GitHub <noreply@github.com> 2020-04-17 10:57:35 +0200
commitae70374b0323dc26f560b28414d2d270c06ddd50 (patch)
tree2716a1d96c0d45d5db7df7cbba7540a2b520aa5f /app/Models/EntryDAO.php
parenta49db010e4a5e48017d8583c374210242a680ddd (diff)
Filter by multiple feed IDs (#2892)
Add the possibility to filter by feed ID like `f:123 more-search` or multiple feed IDs, like `f:123,234,345 more-search` or an exclusion like `!f:456,789 more-search`
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 1cca5cd75..9ee59fc5a 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -703,6 +703,26 @@ SQL;
continue;
}
$sub_search = '';
+
+ if ($filter->getFeedIds()) {
+ $sub_search .= 'AND ' . $alias . 'id_feed IN (';
+ foreach ($filter->getFeedIds() as $feed_id) {
+ $sub_search .= '?,';
+ $values[] = $feed_id;
+ }
+ $sub_search = rtrim($sub_search, ',');
+ $sub_search .= ') ';
+ }
+ if ($filter->getNotFeedIds()) {
+ $sub_search .= 'AND ' . $alias . 'id_feed NOT IN (';
+ foreach ($filter->getNotFeedIds() as $feed_id) {
+ $sub_search .= '?,';
+ $values[] = $feed_id;
+ }
+ $sub_search = rtrim($sub_search, ',');
+ $sub_search .= ') ';
+ }
+
if ($filter->getMinDate()) {
$sub_search .= 'AND ' . $alias . 'id >= ? ';
$values[] = "{$filter->getMinDate()}000000";