mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
3c484557b0
commit
ae388c7d54
@ -402,7 +402,7 @@ HTML
|
|||||||
$i=0;
|
$i=0;
|
||||||
|
|
||||||
//$k is the key of base table, $v is an array with joined table and join key, such as
|
//$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")
|
// otherwise it treats it as a SQL-string ("LEFT JOIN x ON x=y")
|
||||||
foreach($this->join as $k => $v){
|
foreach($this->join as $k => $v){
|
||||||
$join .= ( $i==0 ) ? "" :" ";
|
$join .= ( $i==0 ) ? "" :" ";
|
||||||
@ -414,7 +414,9 @@ HTML
|
|||||||
if(!$k || !is_string($k)) $k = $v['joinColumn'];
|
if(!$k || !is_string($k)) $k = $v['joinColumn'];
|
||||||
if(!$v['howtojoin']) $v['howtojoin'] = "LEFT JOIN";
|
if(!$v['howtojoin']) $v['howtojoin'] = "LEFT JOIN";
|
||||||
$this->joinedTables[] = $v['table'];
|
$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++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user