Commit 502103d7 authored by romanb's avatar romanb

Performance improvements and a small fix.

parent 56007982
......@@ -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);
......
......@@ -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) {
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;
}
/**
......
......@@ -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];
}
......
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