/** * Takes an associative array and creates a groupContact object. * * the function extract all the params it needs to initialize the create a * group object. the params array could contain additional unused name/value * pairs * * @param array $params * (reference ) an assoc array of name/value pairs. * * @return CRM_Contact_BAO_Group */ public static function add(&$params) { $dataExists = self::dataExists($params); if (!$dataExists) { return NULL; } $groupContact = new CRM_Contact_BAO_GroupContact(); $groupContact->copyValues($params); CRM_Contact_BAO_SubscriptionHistory::create($params); $groupContact->save(); return $groupContact; }