diff --git a/draft/new-core/Hydrate.php b/draft/new-core/Hydrate.php index 6e947ac69..5506cfc10 100644 --- a/draft/new-core/Hydrate.php +++ b/draft/new-core/Hydrate.php @@ -58,14 +58,7 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access * constant for CREATE queries */ const CREATE = 4; - /** - * @var array $tables an array containing all the tables used in the query - */ - protected $tables = array(); - /** - * @var array $joins an array containing all table joins - */ - protected $joins = array(); + /** * @var array $params query input parameters */ @@ -79,24 +72,26 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access */ protected $view; /** - * @var boolean $inheritanceApplied + * @var array $_aliasMap two dimensional array containing the map for query aliases + * Main keys are component aliases + * + * table table object associated with given alias + * + * */ - protected $inheritanceApplied = false; - /** - * @var array $compAliases - */ - protected $compAliases = array(); + protected $_aliasMap = array(); + /** * @var array $tableAliases */ protected $tableAliases = array(); /** - * @var array $tableIndexes + * */ - protected $tableIndexes = array(); - protected $pendingAggregates = array(); - + /** + * + */ protected $subqueryAggregates = array(); /** * @var array $aggregateMap an array containing all aggregate aliases, keys as dql aliases @@ -141,15 +136,6 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access $this->conn = $connection; $this->aliasHandler = new Doctrine_Hydrate_Alias(); } - /** - * getComponentAliases - * - * @return array - */ - public function getComponentAliases() - { - return $this->compAliases; - } /** * getTableAliases * @@ -159,24 +145,6 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access { return $this->tableAliases; } - /** - * getTableIndexes - * - * @return array - */ - public function getTableIndexes() - { - return $this->tableIndexes; - } - /** - * getTables - * - * @return array - */ - public function getTables() - { - return $this->tables; - } /** * copyAliases * @@ -191,15 +159,6 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access return $this; } - - public function getPathAlias($path) - { - $s = array_search($path, $this->compAliases); - if ($s === false) - return $path; - - return $s; - } /** * createSubquery * @@ -316,22 +275,6 @@ abstract class Doctrine_Hydrate2 extends Doctrine_Access { return $this->params; } - /** - * getTableAlias - * - * @param string $path - * @return string - */ - final public function getTableAlias($path) - { - if (isset($this->compAliases[$path])) { - $path = $this->compAliases[$path]; - } - if ( ! isset($this->tableAliases[$path])) { - return false; - } - return $this->tableAliases[$path]; - } /** * setParams * diff --git a/tests/NewCoreTestCase.php b/tests/NewCoreTestCase.php index ee207132f..c7c84af73 100644 --- a/tests/NewCoreTestCase.php +++ b/tests/NewCoreTestCase.php @@ -19,6 +19,12 @@ * . */ + +require_once('../draft/new-core/Record.php'); +require_once('../draft/new-core/Hydrate.php'); +require_once('../draft/new-core/Query.php'); +require_once('../draft/new-core/Collection.php'); + /** * Doctrine_NewCore_TestCase * @@ -30,10 +36,13 @@ * @since 1.0 * @version $Revision$ */ + + class Doctrine_NewCore_TestCase extends Doctrine_UnitTestCase { public function testHydrate() { - - } + $q = new Doctrine_Query2(); + $q->from('User u LEFT JOIN u.Phonenumber p')->execute(); + } } diff --git a/tests/Query/AggregateValueTestCase.php b/tests/Query/AggregateValueTestCase.php index 3dc3cf9cd..62b9ae62a 100644 --- a/tests/Query/AggregateValueTestCase.php +++ b/tests/Query/AggregateValueTestCase.php @@ -128,9 +128,15 @@ class Doctrine_Query_AggregateValue_TestCase extends Doctrine_UnitTestCase $this->assertEqual($users->count(), 1); } - public function testAggregateValueMappingSupportsLeftJoins3() + public function testAggregateValueMappingSupportsMultipleValues() { + $q = new Doctrine_Query(); + $q->select('u.name, COUNT(p.id) count, MAX(p.id) max')->from('User u')->innerJoin('u.Phonenumber p')->groupby('u.id'); + + $users = $q->execute(); + $this->assertEqual($users[0]->Phonenumber[0]->max, 3); + $this->assertEqual($users[0]->Phonenumber[0]->count, 3); } public function testAggregateValueMappingSupportsInnerJoins() {