From a21927e4624c825fed49e01161e5a8aca0f2bf3e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 01:42:27 +0000 Subject: [PATCH] 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 --- security/Group.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/security/Group.php b/security/Group.php index 19b95b7b3..e4be6b566 100644 --- a/security/Group.php +++ b/security/Group.php @@ -262,18 +262,19 @@ class Group extends DataObject { $chunkToAdd = array(array("ID" => $this->ID)); while($chunkToAdd) { - $idList = null; + $idList = array(); foreach($chunkToAdd as $item) { $idList[] = $item['ID']; $familyIDs[] = $item['ID']; } - $idList = implode(',',$idList); + $idList = implode(',', $idList); // Get the children of *all* the groups identified in the previous chunk. // This minimises the number of SQL queries necessary $sql = $this->extendedSQL("\"ParentID\" IN ($idList)", ""); - $chunkToAdd = $sql->execute(); - if(!$chunkToAdd->column()) $chunkToAdd = null; + $dbResult = $sql->execute(); + $chunkToAdd = array(); + foreach($dbResult as $item) $chunkToAdd[] = $item; } return $familyIDs;