aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Model/Map.php
diff options
context:
space:
mode:
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();
}