// CRM-7925
throw new CRM_Core_Exception(ts('The Contact Sub Type does not match the Contact type for this record'));
}
+ // Cast to array as serialization in CRM_Core_DAO::copyValues() will happen only if it is an array.
+ $params['contact_sub_type'] = (array) ($params['contact_sub_type']);
}
}
'contact_sub_type' => $sub_contact_type,
];
$contact = CRM_Contact_BAO_Contact::add($params);
- $this->assertSame($sub_contact_type, $contact->contact_sub_type, 'Wrong contact sub-type saved.');
+ $this->assertSame(
+ CRM_Core_DAO::serializeField($sub_contact_type, $contact->fields()['contact_sub_type']['serialize']),
+ $contact->contact_sub_type,
+ 'Wrong contact sub-type saved.'
+ );
}
/**