Simplified object population mechanism
This commit is contained in:
parent
ca213ac6b9
commit
5de6c0a65b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user