1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

DibiRow is not longer ArrayObject descendant

This commit is contained in:
David Grudl
2010-04-22 23:19:33 +02:00
parent a4c5f327de
commit 784153e98c

View File

@@ -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);
}
}