Commit 5de6c0a6 authored by zYne's avatar zYne

Simplified object population mechanism

parent ca213ac6
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment