diff options
| author | 2013-04-17 19:05:53 +0200 | |
|---|---|---|
| committer | 2013-04-17 19:05:53 +0200 | |
| commit | 392672ab2771c6d22f55017c4ed64a0e00945b23 (patch) | |
| tree | 087ae495e38551392c94d942a4b6f32a7ebae015 /app/models | |
| parent | 6ce2b575eb501733e6936ac4b5f2e70d0f6ca13b (diff) | |
Fix issue #58 : possibilité de vider une catégorie
Diffstat (limited to 'app/models')
| -rwxr-xr-x | app/models/Category.php | 14 | ||||
| -rw-r--r-- | app/models/Feed.php | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/app/models/Category.php b/app/models/Category.php index ae803591f..7ce572e71 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -158,6 +158,20 @@ class CategoryDAO extends Model_pdo { return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } + public function getDefault () { + $sql = 'SELECT * FROM category WHERE id="000000"'; + $stm = $this->bd->prepare ($sql); + + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $cat = HelperCategory::daoToCategory ($res); + + if (isset ($cat[0])) { + return $cat[0]; + } else { + return false; + } + } public function checkDefault () { $def_cat = $this->searchById ('000000'); diff --git a/app/models/Feed.php b/app/models/Feed.php index 070f044a9..222e22256 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -283,6 +283,20 @@ class FeedDAO extends Model_pdo { return false; } } + public function deleteFeedByCategory ($id) { + $sql = 'DELETE FROM feed WHERE category=?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($id); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); + return false; + } + } public function searchById ($id) { $sql = 'SELECT * FROM feed WHERE id=?'; |
