summaryrefslogtreecommitdiffstats
path: root/application/models/Session.php
diff options
context:
space:
mode:
authorSimon2011-01-27 16:25:34 +0100
committerSimon2011-01-27 16:25:34 +0100
commit56d52ed8074385e4ad681db5616c2979ecf674ae (patch)
tree2b968ae2300e2cfa077bd466d9be1173eee28ffb /application/models/Session.php
parentModels hinzugefügt (diff)
downloadpbs2-56d52ed8074385e4ad681db5616c2979ecf674ae.tar.gz
pbs2-56d52ed8074385e4ad681db5616c2979ecf674ae.tar.xz
pbs2-56d52ed8074385e4ad681db5616c2979ecf674ae.zip
erster änderungen an den Models, setter und getter fehlern noch
Diffstat (limited to 'application/models/Session.php')
-rw-r--r--application/models/Session.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/application/models/Session.php b/application/models/Session.php
index 76351d0..8fa9748 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -2,7 +2,42 @@
class Application_Model_Session
{
+ 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;
+ }
}