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

Removed indexGenerator

This commit is contained in:
zYne 2006-09-04 06:23:38 +00:00
parent b340bfe11d
commit 2e3f800265
2 changed files with 16 additions and 43 deletions

View File

@ -1,25 +0,0 @@
<?php
class Doctrine_IndexGenerator {
/**
* @var string $name
*/
private $name;
/**
* @param string $name
*/
public function __construct($name) {
$this->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;
}
}

View File

@ -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] === self::$null)
$a[$v] = null;
else
$a[$v] = $this->data[$v];
}
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];
}
foreach($this->table->getInheritanceMap() as $k => $v) {