summaryrefslogtreecommitdiff
path: root/app/models/Feed.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/Feed.php')
-rw-r--r--app/models/Feed.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 92a20eb80..399c34d18 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -37,6 +37,10 @@ class Feed extends Model {
public function description () {
return $this->description;
}
+ public function nbEntries () {
+ $feedDAO = new FeedDAO ();
+ return $feedDAO->countEntries ($this->id ());
+ }
public function _url ($value) {
if (!is_null ($value) && filter_var ($value, FILTER_VALIDATE_URL)) {
@@ -186,6 +190,16 @@ class FeedDAO extends Model_pdo {
return $res[0]['count'];
}
+
+ public function countEntries ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM entry WHERE id_feed=?';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
}
class HelperFeed {