toArray() added
This commit is contained in:
parent
af59b140e0
commit
65c9e56c86
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user