diff options
author | Alessandro <acosenti@malutchosky.(none)> | 2012-06-02 11:40:35 -0400 |
---|---|---|
committer | Alessandro <acosenti@malutchosky.(none)> | 2012-06-02 11:40:35 -0400 |
commit | 3f35d59911ea3e90c4a47249b4a9e7ca49de2cdb (patch) | |
tree | c3d0bb3ea07eca40dec65158c9477eb13e33ea08 /lib/feedmapper.php | |
parent | e10cdc67c446e768bc4ef8e0b2a73a3def59bcca (diff) |
adds delete functions in the mapper
Diffstat (limited to 'lib/feedmapper.php')
-rw-r--r-- | lib/feedmapper.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php index 737b17d80..e352c7ea7 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -66,7 +66,7 @@ class OC_News_FeedMapper { * @brief Find the id of a feed and all its items from the database * @param url url of the feed * @return id of the feed corresponding to the url passed as parameters - null - if there is no such feed + * null - if there is no such feed */ public function findIdFromUrl($url){ $stmt = OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE url = ?'); @@ -84,6 +84,7 @@ class OC_News_FeedMapper { * @param feed the feed to be saved * @returns The id of the feed in the database table. */ + //TODO: handle error case public function insert(OC_News_Feed $feed, $folderid){ $CONFIG_DBTYPE = OCP\Config::getSystemValue( "dbtype", "sqlite" ); if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ @@ -132,4 +133,23 @@ class OC_News_FeedMapper { } return $feedid; } + + public function delete(OC_News_Feed $feed){ + + $id = $feed->getId(); + + $stmt = OCP\DB::prepare(" + DELETE FROM " . self::tableName . + "WHERE id = $id + "); + + $result = $stmt->execute(); + + $itemMapper = new OC_News_ItemMapper(); + //TODO: handle the value that the execute returns + $itemMapper->deleteAll($id); + + return true; + + } }
\ No newline at end of file |