summaryrefslogtreecommitdiffstats
path: root/application/models/Group.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/models/Group.php')
-rw-r--r--application/models/Group.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/application/models/Group.php b/application/models/Group.php
new file mode 100644
index 0000000..60fefad
--- /dev/null
+++ b/application/models/Group.php
@@ -0,0 +1,43 @@
+<?php
+
+class Application_Model_Group
+{
+ 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;
+ }
+
+}
+