1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Simplified object population mechanism

This commit is contained in:
zYne 2006-10-01 15:18:04 +00:00
parent ca213ac6b9
commit 5de6c0a65b

View File

@ -273,37 +273,8 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
if($this->aggregate)
return $stmt->fetchAll(PDO::FETCH_ASSOC);
switch(count($this->tables)):
case 0:
if(count($this->tables) == 0)
throw new Doctrine_Exception("No tables selected");
break;
case 1:
$keys = array_keys($this->tables);
$name = $this->tables[$keys[0]]->getComponentName();
while($data = $stmt->fetch(PDO::FETCH_ASSOC)):
foreach($data as $key => $value):
$e = explode("__",$key);
if(count($e) > 1) {
$data[end($e)] = $value;
} else {
$data[$e[0]] = $value;
}
unset($data[$key]);
endforeach;
$this->data[$name][] = $data;
endwhile;
return $this->getCollection($keys[0]);
break;
default:
$keys = array_keys($this->tables);
$root = $keys[0];
@ -378,7 +349,6 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
}
return $coll;
endswitch;
}
/**
* initRelation