1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Performance improvements and a small fix.

This commit is contained in:
romanb 2007-05-27 20:00:53 +00:00
parent 560079825e
commit 502103d7a4
3 changed files with 2160 additions and 2160 deletions

View File

@ -668,7 +668,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
}
$class = $name . 'Table';
if (class_exists($class) && in_array('Doctrine_Table', class_parents($class))) {
if (class_exists($class, false) && in_array('Doctrine_Table', class_parents($class))) {
$table = new $class($name, $this);
} else {
$table = new Doctrine_Table($name, $this);

View File

@ -902,25 +902,24 @@ class Doctrine_Hydrate implements Serializable
public function parseData($stmt)
{
$array = array();
$cache = array();
while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
/**
* parse the data into two-dimensional array
*/
foreach ($data as $key => $value) {
$e = explode('__', $key);
if (!isset($cache[$key])) {
$e = explode('__', $key);
$cache[$key]['field'] = strtolower(array_pop($e));
$cache[$key]['component'] = strtolower(implode('__', $e));
}
$field = strtolower(array_pop($e));
$tableAlias = strtolower(implode('__', $e));
$data[$tableAlias][$field] = $value;
$data[$cache[$key]['component']][$cache[$key]['field']] = $value;
unset($data[$key]);
}
};
$array[] = $data;
}
};
$stmt->closeCursor();
unset($cache);
return $array;
}
/**

View File

@ -591,6 +591,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
*/
public function getColumnName($alias)
{
$alias = strtolower($alias);
if(isset($this->columnAliases[$alias])) {
return $this->columnAliases[$alias];
}