summaryrefslogtreecommitdiff
path: root/framework/Data/DataGateway
diff options
context:
space:
mode:
authorwei <>2007-04-24 06:14:56 +0000
committerwei <>2007-04-24 06:14:56 +0000
commitd5eb713888715e8f18d2ccf508a8eb0b1a483ad1 (patch)
tree3752f12f0a9379681e13171df805e8f5760c53ec /framework/Data/DataGateway
parent1c74ee3c07cd2b25670826d44f7a1b1959302ce3 (diff)
add active record Relations
Diffstat (limited to 'framework/Data/DataGateway')
-rw-r--r--framework/Data/DataGateway/TDataGatewayCommand.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/framework/Data/DataGateway/TDataGatewayCommand.php b/framework/Data/DataGateway/TDataGatewayCommand.php
index 43a57aa7..80856a0e 100644
--- a/framework/Data/DataGateway/TDataGatewayCommand.php
+++ b/framework/Data/DataGateway/TDataGatewayCommand.php
@@ -179,7 +179,7 @@ class TDataGatewayCommand extends TComponent
public function findAllByIndex($criteria,$fields,$values)
{
- $index = $this->getIndexKeyCondition($fields,$values);
+ $index = $this->getIndexKeyCondition($this->getTableInfo(),$fields,$values);
if(strlen($where = $criteria->getCondition())>0)
$criteria->setCondition("({$index}) AND ({$where})");
else
@@ -202,11 +202,12 @@ class TDataGatewayCommand extends TComponent
return $this->onExecuteCommand($command,$command->execute());
}
- protected function getIndexKeyCondition($fields,$values)
+ public function getIndexKeyCondition($table,$fields,$values)
{
$columns = array();
+ $tableName = $table->getTableFullName();
foreach($fields as $field)
- $columns[] = $this->getTableInfo()->getColumn($field)->getColumnName();
+ $columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values);
}
@@ -236,7 +237,7 @@ class TDataGatewayCommand extends TComponent
throw new TDbException('dbtablegateway_pk_value_count_mismatch',
$this->getTableInfo()->getTableFullName());
}
- return $this->getIndexKeyCondition($primary, $values);
+ return $this->getIndexKeyCondition($this->getTableInfo(),$primary, $values);
}
/**