aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Category.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Category.php')
-rw-r--r--app/Models/Category.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 29c0e586b..a0ee1ddaa 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -8,6 +8,7 @@ class FreshRSS_Category extends Minz_Model {
private $feeds = null;
private $hasFeedsWithError = false;
private $isDefault = false;
+ private $attributes = [];
public function __construct($name = '', $feeds = null) {
$this->_name($name);
@@ -68,6 +69,14 @@ class FreshRSS_Category extends Minz_Model {
return $this->hasFeedsWithError;
}
+ public function attributes($key = '') {
+ if ($key == '') {
+ return $this->attributes;
+ } else {
+ return isset($this->attributes[$key]) ? $this->attributes[$key] : null;
+ }
+ }
+
public function _id($id) {
$this->id = $id;
if ($id == FreshRSS_CategoryDAO::DEFAULTCATEGORYID) {
@@ -87,4 +96,19 @@ class FreshRSS_Category extends Minz_Model {
$this->feeds = $values;
}
+
+ public function _attributes($key, $value) {
+ if ($key == '') {
+ if (is_string($value)) {
+ $value = json_decode($value, true);
+ }
+ if (is_array($value)) {
+ $this->attributes = $value;
+ }
+ } elseif ($value === null) {
+ unset($this->attributes[$key]);
+ } else {
+ $this->attributes[$key] = $value;
+ }
+ }
}