From 37898ac06ab20831be0d117eee7033ce6dca2971 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Thu, 8 Nov 2007 18:54:55 +0000 Subject: [PATCH] Fix to toArray() when you use toArray(true) on a record that has not been saved yet but has references --- lib/Doctrine/Record.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 068449f76..a1e234d43 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -1165,7 +1165,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count $a = array(); foreach ($this as $column => $value) { - if ($value === self::$_null) { + if ($value === self::$_null || is_object($value)) { $value = null; } $a[$column] = $value; @@ -1187,10 +1187,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count { if (is_array($array)) { foreach ($array as $key => $value) { - if ($this->getTable()->hasRelation($key) && $value) { + if ($this->getTable()->hasRelation($key)) { $this->$key->fromArray($value); - } else if($this->getTable()->hasColumn($key) && $value) { - $this->$key = $value; + } else if($this->getTable()->hasColumn($key)) { + $this->set($key, $value); } } }