diff options
Diffstat (limited to 'application/models/Right.php')
-rw-r--r-- | application/models/Right.php | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/application/models/Right.php b/application/models/Right.php index c0df29c..874453c 100644 --- a/application/models/Right.php +++ b/application/models/Right.php @@ -3,6 +3,7 @@ class Application_Model_Right { protected $_rightID; + protected $_rightcategoryID; protected $_title; protected $_description; @@ -53,6 +54,15 @@ class Application_Model_Right $this->_rightID = $_rightID; return $this; } + public function getRightcategoryID() + { + return $this->_rightcategoryID; + } + public function setRightcategoryID($_rightcategoryID) + { + $this->_rightID = $_rightcategoryID; + return $this; + } public function getTitle() { return $this->_title; @@ -71,39 +81,39 @@ class Application_Model_Right $this->_description = $_description; return $this; } - /** - * Returns current data as associative array using ReflectionClass - * - * @return array Returns associative array containing model data + /** + * Returns current data as associative array using ReflectionClass + * + * @return array Returns associative array containing model data * If "get"-method not available (our primary keys) the function getID() is called - */ - public function toArray() - { - $reflectionClass = new ReflectionClass($this); - $properties = $reflectionClass->getProperties(); - $result = array(); - foreach ($properties as $property) { - $key = $property->name; - if (substr($key, 0, 1) != '_' && $this->$key !== null) { - $method = 'get' . ucfirst($key); - if ($reflectionClass->hasMethod($method)) { - $result[$key] = $this->$method(); - } else { - $result[$key] = $this->$key; - } - } + */ + public function toArray() + { + $reflectionClass = new ReflectionClass($this); + $properties = $reflectionClass->getProperties(); + $result = array(); + foreach ($properties as $property) { + $key = $property->name; + if (substr($key, 0, 1) != '_' && $this->$key !== null) { + $method = 'get' . ucfirst($key); + if ($reflectionClass->hasMethod($method)) { + $result[$key] = $this->$method(); + } else { + $result[$key] = $this->$key; + } + } elseif(substr($key, 0, 1) == '_' && $this->$key !== null) { $key = substr($key, 1); - $method = 'get' . ucfirst($key); + $method = 'get' . ucfirst($key); if ($reflectionClass->hasMethod($method)) { $result[$key] = $this->$method(); }else{ $result[$key] = $this->getID(); } - + } - } - return $result; - } + } + return $result; + } } |