Merge pull request #795 from theorytank/3.0

FIX: collateFamilyIDs() nested groups throws error
This commit is contained in:
Will Rossiter 2012-09-14 14:20:26 -07:00
commit 86dc36ca21

View File

@ -271,15 +271,11 @@ class Group extends DataObject {
*/
public function collateFamilyIDs() {
$familyIDs = array();
$chunkToAdd = array(array("ID" => $this->ID));
$chunkToAdd = array($this->ID);
while($chunkToAdd) {
$idList = array();
foreach($chunkToAdd as $item) {
$idList[] = $item['ID'];
$familyIDs[] = $item['ID'];
}
$idList = implode(',', $idList);
$familyIDs = array_merge($familyIDs,$chunkToAdd);
$idList = implode(',', $chunkToAdd);
// Get the children of *all* the groups identified in the previous chunk.
// This minimises the number of SQL queries necessary