From 7512229bcaaf39dc2ca6e9b18770db04a6f800fa Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 27 Jan 2011 17:32:56 +0100 Subject: Getter und Setter für Models gesetzt --- application/models/Role.php | 115 ++++++++++++++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 35 deletions(-) (limited to 'application/models/Role.php') diff --git a/application/models/Role.php b/application/models/Role.php index 67df23a..e8812b9 100644 --- a/application/models/Role.php +++ b/application/models/Role.php @@ -2,42 +2,87 @@ class Application_Model_Role { + protected $_roleID; + protected $_groupID; + protected $_title; + protected $_description; + public function __construct(array $options = null) - { - if (is_array($options)) { - $this->setOptions($options); - } - } - - public function __set($name, $value) - { - $method = 'set' . $name; - if (('mapper' == $name) || !method_exists($this, $method)) { - throw new Exception('Invalid guestbook property'); - } - $this->$method($value); - } - - public function __get($name) - { - $method = 'get' . $name; - if (('mapper' == $name) || !method_exists($this, $method)) { - throw new Exception('Invalid guestbook property'); - } - return $this->$method(); - } - - public function setOptions(array $options) - { - $methods = get_class_methods($this); - foreach ($options as $key => $value) { - $method = 'set' . ucfirst($key); - if (in_array($method, $methods)) { - $this->$method($value); - } - } - return $this; - } + { + if (is_array($options)) { + $this->setOptions($options); + } + } + + public function __set($name, $value) + { + $method = 'set' . $name; + if (('mapper' == $name) || !method_exists($this, $method)) { + throw new Exception('Invalid role property'); + } + $this->$method($value); + } + + public function __get($name) + { + $method = 'get' . $name; + if (('mapper' == $name) || !method_exists($this, $method)) { + throw new Exception('Invalid role property'); + } + return $this->$method(); + } + + public function setOptions(array $options) + { + $methods = get_class_methods($this); + foreach ($options as $key => $value) { + $method = 'set' . ucfirst($key); + if (in_array($method, $methods)) { + $this->$method($value); + } + } + return $this; + } + + + public function get_roleID() + { + return $this->_roleID; + } + + public function set_roleID($_roleID) + { + $this->_roleID = $_roleID; + } + + public function get_groupID() + { + return $this->_groupID; + } + + public function set_groupID($_groupID) + { + $this->_groupID = $_groupID; + } + + public function get_title() + { + return $this->_title; + } + + public function set_title($_title) + { + $this->_title = $_title; + } + + public function get_description() + { + return $this->_description; + } + public function set_description($_description) + { + $this->_description = $_description; + } } -- cgit v1.2.3-55-g7522