diff options
| author | 2012-10-25 15:52:54 +0200 | |
|---|---|---|
| committer | 2012-10-25 15:52:54 +0200 | |
| commit | 32ee8feccfb28aa3141469581cd04d4813fd6835 (patch) | |
| tree | 1c352659b803d1201ae0403583fe58abb44c8090 /app/models/Feed.php | |
| parent | d21c1bb13875189ab25f7bce4f05cc3fedaa4904 (diff) | |
affichage du nombre d'articles pour un flux donné
Diffstat (limited to 'app/models/Feed.php')
| -rw-r--r-- | app/models/Feed.php | 14 |
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 { |
