Fix to toArray() when you use toArray(true) on a record that has not been saved yet but has references
This commit is contained in:
parent
0003c233d4
commit
37898ac06a
@ -1165,7 +1165,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
|||||||
$a = array();
|
$a = array();
|
||||||
|
|
||||||
foreach ($this as $column => $value) {
|
foreach ($this as $column => $value) {
|
||||||
if ($value === self::$_null) {
|
if ($value === self::$_null || is_object($value)) {
|
||||||
$value = null;
|
$value = null;
|
||||||
}
|
}
|
||||||
$a[$column] = $value;
|
$a[$column] = $value;
|
||||||
@ -1187,10 +1187,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
|||||||
{
|
{
|
||||||
if (is_array($array)) {
|
if (is_array($array)) {
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
if ($this->getTable()->hasRelation($key) && $value) {
|
if ($this->getTable()->hasRelation($key)) {
|
||||||
$this->$key->fromArray($value);
|
$this->$key->fromArray($value);
|
||||||
} else if($this->getTable()->hasColumn($key) && $value) {
|
} else if($this->getTable()->hasColumn($key)) {
|
||||||
$this->$key = $value;
|
$this->set($key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user