Skip to content

Commit

Permalink
Merge pull request #10486 from mickadoo/CRM-20710_get-valid-types-fun…
Browse files Browse the repository at this point in the history
…ction

CRM-20710: Add function to return valid types
  • Loading branch information
colemanw authored Oct 13, 2017
2 parents b17f042 + 067c2e0 commit a057aee
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion CRM/Utils/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,28 @@ public static function typeToString($type) {
return (isset($string)) ? $string : "";
}

/**
* @return array
* An array of type in the form 'type name' => 'int representing type'
*/
public static function getValidTypes() {
return array(
'Int' => self::T_INT,
'String' => self::T_STRING,
'Enum' => self::T_ENUM,
'Date' => self::T_DATE,
'Time' => self::T_TIME,
'Boolean' => self::T_BOOLEAN,
'Text' => self::T_TEXT,
'Blob' => self::T_BLOB,
'Timestamp' => self::T_TIMESTAMP,
'Float' => self::T_FLOAT,
'Money' => self::T_MONEY,
'Email' => self::T_EMAIL,
'Mediumblob' => self::T_MEDIUMBLOB,
);
}

/**
* Get the data_type for the field.
*
Expand Down Expand Up @@ -524,7 +546,7 @@ public static function mysqlOrderByCallback($matches) {
}

/**
* Get list of avaliable Data Tupes for Option Groups
* Get list of avaliable Data Types for Option Groups
*
* @return array
*/
Expand Down

0 comments on commit a057aee

Please sign in to comment.