From 54fcf19fdc20728a02f1beae4c9bf42a0fe41900 Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 24 May 2007 18:35:52 +0000 Subject: [PATCH] --- lib/Doctrine/Hydrate.php | 33 +++++++++++++++++++++++----- lib/Doctrine/Query/JoinCondition.php | 2 +- lib/Doctrine/Query/Set.php | 5 ++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index f3a71ed9a..7136e206b 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -295,13 +295,20 @@ class Doctrine_Hydrate return $this; } - public function getDeclaration($name) + /** + * getAliasDeclaration + * get the declaration for given component alias + * + * @param string $componentAlias the component alias the retrieve the declaration from + * @return array the alias declaration + */ + public function getAliasDeclaration($componentAlias) { - if ( ! isset($this->_aliasMap[$name])) { - throw new Doctrine_Hydrate_Exception('Unknown component alias ' . $name); + if ( ! isset($this->_aliasMap[$componentAlias])) { + throw new Doctrine_Hydrate_Exception('Unknown component alias ' . $componentAlias); } - return $this->_aliasMap[$name]; + return $this->_aliasMap[$componentAlias]; } /** * setQueryPart @@ -364,6 +371,7 @@ class Doctrine_Hydrate } /** * limitSubqueryUsed + * whether or not limit subquery was used * * @return boolean */ @@ -485,10 +493,25 @@ class Doctrine_Hydrate { return $params; } - public function setAliasMap($map) + /** + * setAliasMap + * sets the whole component alias map + * + * @param array $map alias map + * @return Doctrine_Hydrate this object + */ + public function setAliasMap(array $map) { $this->_aliasMap = $map; + + return $this; } + /** + * getAliasMap + * returns the component alias map + * + * @return array component alias map + */ public function getAliasMap() { return $this->_aliasMap; diff --git a/lib/Doctrine/Query/JoinCondition.php b/lib/Doctrine/Query/JoinCondition.php index f498a50e6..472856791 100644 --- a/lib/Doctrine/Query/JoinCondition.php +++ b/lib/Doctrine/Query/JoinCondition.php @@ -46,7 +46,7 @@ class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition $value = $e[2]; $alias = $this->query->getTableAlias($reference); - $map = $this->query->getDeclaration($reference); + $map = $this->query->getAliasDeclaration($reference); $table = $map['table']; // check if value is enumerated value $enumIndex = $table->enumIndex($field, trim($value, "'")); diff --git a/lib/Doctrine/Query/Set.php b/lib/Doctrine/Query/Set.php index 8817a8a6c..24e60893d 100644 --- a/lib/Doctrine/Query/Set.php +++ b/lib/Doctrine/Query/Set.php @@ -45,9 +45,8 @@ class Doctrine_Query_Set extends Doctrine_Query_Part $reference = implode('.', $e); - $alias = $this->query->getTableAlias($reference); - - $map = $this->query->getDeclaration($reference); + $alias = $this->query->getTableAlias($reference); + $map = $this->query->getAliasDeclaration($reference); $result[] = $map['table']->getColumnName($field) . ' = ' . $set[1]; }