diff --git a/Doctrine/IndexGenerator.php b/Doctrine/IndexGenerator.php deleted file mode 100644 index b5cb4f99a..000000000 --- a/Doctrine/IndexGenerator.php +++ /dev/null @@ -1,25 +0,0 @@ -name = $name; - } - /** - * @param Doctrine_Record $record - * @return mixed - */ - public function getIndex(Doctrine_Record $record) { - $value = $record->get($this->name); - if($value === null) - throw new Doctrine_Exception("Couldn't create collection index. Record field '".$this->name."' was null."); - - return $value; - } -} - diff --git a/Doctrine/Record.php b/Doctrine/Record.php index e289231ee..e073eb984 100644 --- a/Doctrine/Record.php +++ b/Doctrine/Record.php @@ -800,26 +800,24 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite foreach($array as $k => $v) { $type = $this->table->getTypeOf($v); - if($type == 'array' || - $type == 'object') { + switch($type) { + case 'array': + case 'object': + $a[$v] = serialize($this->data[$v]); + break;; + case 'enum' + $a[$v] = $this->table->enumIndex($v,$this->data[$v]); + break; + default: + if($this->data[$v] instanceof Doctrine_Record) + $this->data[$v] = $this->data[$v]->getIncremented(); - $a[$v] = serialize($this->data[$v]); - continue; - - } elseif($type == 'enum') { - $a[$v] = $this->table->enumIndex($v,$this->data[$v]); - continue; - } - - if($this->data[$v] instanceof Doctrine_Record) { - $this->data[$v] = $this->data[$v]->getIncremented(); - } - if($this->data[$v] === self::$null) - $a[$v] = null; - else - $a[$v] = $this->data[$v]; - + if($this->data[$v] === self::$null) + $a[$v] = null; + else + $a[$v] = $this->data[$v]; + } } foreach($this->table->getInheritanceMap() as $k => $v) {