Commit 65c9e56c authored by zYne's avatar zYne

toArray() added

parent af59b140
...@@ -844,6 +844,24 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -844,6 +844,24 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
public function getColumnCount() { public function getColumnCount() {
return $this->count(); return $this->count();
} }
/**
* toArray
* returns record as an array
*
* @return array
*/
public function toArray() {
$a = array();
foreach($this as $column => $value) {
$a[$column] = $value;
}
if($this->table->getIdentifierType() == Doctrine_Identifier::AUTO_INCREMENT) {
$i = $this->table->getIdentifier();
$a[$i] = $this->getIncremented();
}
return $a;
}
/** /**
* checks if record has data * checks if record has data
* @return boolean * @return boolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment