aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Model/Map.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-05-08 15:26:22 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-05-08 15:26:22 +0000
commitafc02bc1c3db9ffe8c9bf660c8aa08666752edfb (patch)
tree9a02b06b390dd0c1e796474b888e92c245473424 /h-source/Library/Model/Map.php
parent7fdac301801bc44f6fdb343187413bdfd2d5366c (diff)
h-source:added new EasyGiant SVN version
Diffstat (limited to 'h-source/Library/Model/Map.php')
-rwxr-xr-xh-source/Library/Model/Map.php35
1 files changed, 16 insertions, 19 deletions
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();
}