1
0
mirror of synced 2025-01-17 22:11:41 +03:00

Refactored the object population algorithm

This commit is contained in:
zYne 2006-09-28 13:39:37 +00:00
parent 753e9bd4cc
commit 25956bea87

View File

@ -331,25 +331,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
if(empty($row))
continue;
$ids = $this->tables[$key]->getIdentifier();
$emptyID = false;
if(is_array($ids)) {
foreach($ids as $id) {
if($row[$id] == null) {
$emptyID = true;
break;
}
}
} else {
if( ! isset($row[$ids]))
$emptyID = true;
}
$ids = $this->tables[$key]->getIdentifier();
$name = $key;
if($emptyID) {
if($this->isIdentifiable($row, $ids)) {
$pointer = $this->joins[$name];
@ -481,6 +466,26 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
}
return $coll;
}
/**
* hasEmptyIdentifier
*
* @param array $row
* @param mixed $ids
* @return boolean
*/
public function isIdentifiable(array $row, $ids) {
$emptyID = false;
if(is_array($ids)) {
foreach($ids as $id) {
if($row[$id] == null)
return true;
}
} else {
if( ! isset($row[$ids]))
return true;
}
return false;
}
/**
* applyInheritance
* applies column aggregation inheritance to DQL / SQL query