/** * Function to get values * * @param array $params name/value pairs with field names/values * @return array $result found rows with data * @access public * @static */ public static function getValues($params) { $result = array(); $segment = new CRM_Contactsegment_BAO_Segment(); if (!empty($params)) { $fields = self::fields(); foreach ($params as $paramKey => $paramValue) { if (isset($fields[$paramKey])) { $segment->{$paramKey} = $paramValue; } } } $segment->find(); while ($segment->fetch()) { $row = array(); self::storeValues($segment, $row); if (!isset($row['parent_id']) || empty($row['parent_id'])) { $row['parent_id'] = NULL; } $result[$row['id']] = $row; } return $result; }