Skip to content

Commit

Permalink
CRM-20710: Add function to return valid types
Browse files Browse the repository at this point in the history
  • Loading branch information
mickadoo committed Jun 9, 2017
1 parent 6fa98bc commit 067c2e0
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 @@ -518,7 +540,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 067c2e0

Please sign in to comment.