1
0
mirror of synced 2024-12-13 06:46:03 +03:00

toArray() added

This commit is contained in:
zYne 2006-09-07 21:28:47 +00:00
parent af59b140e0
commit 65c9e56c86

View File

@ -844,6 +844,24 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
public function getColumnCount() {
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
* @return boolean