From 784153e98cdfa71a3b45198156b2b7e29b8d0ec0 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 22 Apr 2010 23:19:33 +0200 Subject: [PATCH] DibiRow is not longer ArrayObject descendant --- dibi/libs/DibiRow.php | 59 ++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/dibi/libs/DibiRow.php b/dibi/libs/DibiRow.php index fecc6fe6..b0867f17 100644 --- a/dibi/libs/DibiRow.php +++ b/dibi/libs/DibiRow.php @@ -18,15 +18,12 @@ * @copyright Copyright (c) 2005, 2010 David Grudl * @package dibi */ -class DibiRow extends ArrayObject +class DibiRow implements ArrayAccess, IteratorAggregate { - /** - * @param array - */ - public function __construct($arr) + function __construct($arr) { - parent::__construct($arr, 2); + foreach ($arr as $k => $v) $this->$k = $v; } @@ -82,17 +79,6 @@ class DibiRow extends ArrayObject - /** - * PHP < 5.3 workaround - * @return void - */ - public function __wakeup() - { - $this->setFlags(2); - } - - - /** @deprecated */ public function asDate($key, $format = NULL) { @@ -103,4 +89,43 @@ class DibiRow extends ArrayObject } } + + + /********************* interfaces ArrayAccess & IteratorAggregate ****************d*g**/ + + + + final public function getIterator() + { + return new ArrayIterator($this); + } + + + + final public function offsetSet($nm, $val) + { + $this->$nm = $val; + } + + + + final public function offsetGet($nm) + { + return $this->$nm; + } + + + + final public function offsetExists($nm) + { + return isset($this->$nm); + } + + + + final public function offsetUnset($nm) + { + unset($this->$nm); + } + }