/**
* @deprecated format using php serialize()
*/
- SERIALIZE_PHP = 4;
+ SERIALIZE_PHP = 4,
+ /**
+ * Comma separated string, no quotes, no spaces
+ */
+ SERIALIZE_COMMA = 5;
/**
* Define entities that shouldn't be created or deleted when creating/ deleting
* @param array|NULL $value
* @param $serializationType
* @return string|NULL
+ * @throws \Exception
*/
public static function serializeField($value, $serializationType) {
if ($value === NULL) {
case self::SERIALIZE_PHP:
return is_array($value) ? serialize($value) : $value;
+
+ case self::SERIALIZE_COMMA:
+ return is_array($value) ? implode(',', $value) : $value;
+
+ default:
+ throw new Exception('Unknown serialization method for field.');
}
}
* @param string|null $value
* @param $serializationType
* @return array|null
+ * @throws \Exception
*/
public static function unSerializeField($value, $serializationType) {
if ($value === NULL) {
case self::SERIALIZE_PHP:
return strlen($value) ? unserialize($value) : array();
+
+ case self::SERIALIZE_COMMA:
+ return explode(',', trim(str_replace(', ', '', $value)));
+
+ default:
+ throw new Exception('Unknown serialization method for field.');
}
}
*
* Generated from xml/schema/CRM/Core/UFGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2c943baba637124caec29c4aefeb9228)
+ * (GenCodeChecksum:a33112c87c32c1af77464d08a8715bdb)
*/
/**
public $is_active;
/**
- * This column will store a comma separated list of the type(s) of profile fields.
+ * Comma separated list of the type(s) of profile fields.
*
* @var string
*/
'name' => 'group_type',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Profile Group Type'),
- 'description' => 'This column will store a comma separated list of the type(s) of profile fields.',
+ 'description' => 'Comma separated list of the type(s) of profile fields.',
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'import' => TRUE,
'entity' => 'UFGroup',
'bao' => 'CRM_Core_BAO_UFGroup',
'localizable' => 0,
- 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
+ 'serialize' => self::SERIALIZE_COMMA,
],
'title' => [
'name' => 'title',
<type>varchar</type>
<length>255</length>
<import>true</import>
- <comment>This column will store a comma separated list of the type(s) of profile fields.</comment>
- <serialize>SEPARATOR_TRIMMED</serialize>
+ <comment>Comma separated list of the type(s) of profile fields.</comment>
+ <serialize>COMMA</serialize>
<add>2.1</add>
</field>
<field>