BUGFIX Fixed Group::collateFamilyIDs() when working with MSSQL (from r91775)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92455 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 01:42:27 +00:00
parent 96431c3aa2
commit a21927e462

View File

@ -262,7 +262,7 @@ class Group extends DataObject {
$chunkToAdd = array(array("ID" => $this->ID)); $chunkToAdd = array(array("ID" => $this->ID));
while($chunkToAdd) { while($chunkToAdd) {
$idList = null; $idList = array();
foreach($chunkToAdd as $item) { foreach($chunkToAdd as $item) {
$idList[] = $item['ID']; $idList[] = $item['ID'];
$familyIDs[] = $item['ID']; $familyIDs[] = $item['ID'];
@ -272,8 +272,9 @@ class Group extends DataObject {
// Get the children of *all* the groups identified in the previous chunk. // Get the children of *all* the groups identified in the previous chunk.
// This minimises the number of SQL queries necessary // This minimises the number of SQL queries necessary
$sql = $this->extendedSQL("\"ParentID\" IN ($idList)", ""); $sql = $this->extendedSQL("\"ParentID\" IN ($idList)", "");
$chunkToAdd = $sql->execute(); $dbResult = $sql->execute();
if(!$chunkToAdd->column()) $chunkToAdd = null; $chunkToAdd = array();
foreach($dbResult as $item) $chunkToAdd[] = $item;
} }
return $familyIDs; return $familyIDs;