parents-merge: 32931

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45037 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-11-19 01:09:01 +00:00
parent 3c484557b0
commit ae388c7d54

View File

@ -402,7 +402,7 @@ HTML
$i=0;
//$k is the key of base table, $v is an array with joined table and join key, such as
// $v = array("ID"=>array("table"=>"Payment", "field"=>"OrderID")).
// $v = array("ID"=>array("table"=>"Payment", "field"=>"OrderID", "joinclass" => "Order")).
// otherwise it treats it as a SQL-string ("LEFT JOIN x ON x=y")
foreach($this->join as $k => $v){
$join .= ( $i==0 ) ? "" :" ";
@ -414,7 +414,9 @@ HTML
if(!$k || !is_string($k)) $k = $v['joinColumn'];
if(!$v['howtojoin']) $v['howtojoin'] = "LEFT JOIN";
$this->joinedTables[] = $v['table'];
$join .="$v[howtojoin] `$v[table]` on `{$this->baseClass}`.`$k` = `$v[table]`.`$v[field]`";
// FIX Stupid arbitrary array-structure makes this neccessary
$joinClass = ($v['joinclass']) ? $v['joinclass'] : $this->baseClass;
$join .="$v[howtojoin] `$v[table]` on `{$joinClass}`.`{$k}` = `$v[table]`.`$v[field]`";
}
$i++;
}