public static function getMembersByOrgType($orgType = 0) { $orgs = array(); switch ($orgType) { case 2: $orgs = FM_Components_Business::getAll(); break; case 3: $orgs = FM_Components_NonProfit::getAll(); break; case 4: $orgs = FM_Components_Sports::getAll(); break; default: return FM_Components_Member::getAll(); } if (!count($orgs)) { return $orgs; } //no data send empty array $ids = array(); foreach ($orgs as $org) { $ids[] = $org->getId(); } $userOrgTable = new FM_Models_FM_UserOrg(); $users = $userOrgTable->getRecordsByDataSet('oid', $ids, 'uid'); $allUsers = array(); if (count($users)) { foreach ($users as $user) { $allUsers[$user['uid']] = new FM_Components_Member(array('id' => $user['uid'])); } return $allUsers; } else { return $users; //empty data set send empty array } return false; //everything failed }