From 56d52ed8074385e4ad681db5616c2979ecf674ae Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 27 Jan 2011 16:25:34 +0100 Subject: erster änderungen an den Models, setter und getter fehlern noch --- application/models/GroupRequest.php | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 application/models/GroupRequest.php (limited to 'application/models/GroupRequest.php') diff --git a/application/models/GroupRequest.php b/application/models/GroupRequest.php new file mode 100644 index 0000000..83fc428 --- /dev/null +++ b/application/models/GroupRequest.php @@ -0,0 +1,43 @@ +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; + } + +} + -- cgit v1.2.3-55-g7522