From afc02bc1c3db9ffe8c9bf660c8aa08666752edfb Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 8 May 2011 15:26:22 +0000 Subject: h-source:added new EasyGiant SVN version --- h-source/Library/Model/Map.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'h-source/Library/Model/Map.php') diff --git a/h-source/Library/Model/Map.php b/h-source/Library/Model/Map.php index 4fe562d..10166db 100755 --- a/h-source/Library/Model/Map.php +++ b/h-source/Library/Model/Map.php @@ -42,25 +42,18 @@ class Model_Map extends Model_Base { public function createMapWhere($choice) { //create the where join clause //$choice=(first,last,all) - if (isset($this->on)) - { - return $this->on; - } - else - { - $first = $this->_tablesArray[0].'.'.$this->_idFieldsArray[0].'='.$this->_tablesArray[2].'.'.$this->_idFieldsArray[0]; - $last = $this->_tablesArray[1].'.'.$this->_idFieldsArray[1].'='.$this->_tablesArray[2].'.'.$this->_idFieldsArray[1]; - switch ($choice) { - case 'first': - return $first; - break; - case 'last': - return $last; - break; - case 'all': - return $first. ' and '.$last; - break; - } + $first = $this->_tablesArray[0].'.'.$this->_idFieldsArray[0].'='.$this->_tablesArray[2].'.'.$this->_idFieldsArray[0]; + $last = $this->_tablesArray[1].'.'.$this->_idFieldsArray[1].'='.$this->_tablesArray[2].'.'.$this->_idFieldsArray[1]; + switch ($choice) { + case 'first': + return $first; + break; + case 'last': + return $last; + break; + case 'all': + return $first. ' and '.$last; + break; } } @@ -168,6 +161,8 @@ class Model_Map extends Model_Base { public function selectId($id,$fields = null) { $id = (int)$id; + + $tempWhere = $this->where; $this->setWhereQueryClause(array($this->_idFieldsArray[0] => $id)); if (isset($fields)) @@ -178,6 +173,8 @@ class Model_Map extends Model_Base { { $values = $this->getAll('Items'); } + + $this->where = $tempWhere; return (count($values) > 0) ? $values[0][$this->_tablesArray[0]] : array(); } -- cgit v1.2.3