diff options
Diffstat (limited to 'application/models/RightRoles.php')
-rw-r--r-- | application/models/RightRoles.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/application/models/RightRoles.php b/application/models/RightRoles.php index 4725632..d365781 100644 --- a/application/models/RightRoles.php +++ b/application/models/RightRoles.php @@ -2,7 +2,42 @@ class Application_Model_RightRoles { + 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; + } } |