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';
|
$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);
|
$table = new $class($name, $this);
|
||||||
} else {
|
} else {
|
||||||
$table = new Doctrine_Table($name, $this);
|
$table = new Doctrine_Table($name, $this);
|
||||||
|
@ -902,25 +902,24 @@ class Doctrine_Hydrate implements Serializable
|
|||||||
public function parseData($stmt)
|
public function parseData($stmt)
|
||||||
{
|
{
|
||||||
$array = array();
|
$array = array();
|
||||||
|
$cache = array();
|
||||||
|
|
||||||
while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($data = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
/**
|
|
||||||
* parse the data into two-dimensional array
|
|
||||||
*/
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
|
if (!isset($cache[$key])) {
|
||||||
$e = explode('__', $key);
|
$e = explode('__', $key);
|
||||||
|
$cache[$key]['field'] = strtolower(array_pop($e));
|
||||||
|
$cache[$key]['component'] = strtolower(implode('__', $e));
|
||||||
|
}
|
||||||
|
|
||||||
$field = strtolower(array_pop($e));
|
$data[$cache[$key]['component']][$cache[$key]['field']] = $value;
|
||||||
$tableAlias = strtolower(implode('__', $e));
|
|
||||||
|
|
||||||
$data[$tableAlias][$field] = $value;
|
|
||||||
|
|
||||||
unset($data[$key]);
|
unset($data[$key]);
|
||||||
}
|
};
|
||||||
$array[] = $data;
|
$array[] = $data;
|
||||||
}
|
};
|
||||||
|
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
unset($cache);
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -591,6 +591,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
|||||||
*/
|
*/
|
||||||
public function getColumnName($alias)
|
public function getColumnName($alias)
|
||||||
{
|
{
|
||||||
|
$alias = strtolower($alias);
|
||||||
if(isset($this->columnAliases[$alias])) {
|
if(isset($this->columnAliases[$alias])) {
|
||||||
return $this->columnAliases[$alias];
|
return $this->columnAliases[$alias];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user