Performance improvements and a small fix.
This commit is contained in:
parent
560079825e
commit
502103d7a4
@ -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) {
|
||||
$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;
|
||||
}
|
||||
/**
|
||||
|
@ -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];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user