}
$params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Event_DAO_ParticipantStatusType', $oldWeight, $params['weight']);
- $participantStatus = CRM_Event_BAO_ParticipantStatusType::create($params);
+ $participantStatus = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);
if ($participantStatus->id) {
if ($this->_action & CRM_Core_Action::UPDATE) {
class CRM_Event_BAO_ParticipantStatusType extends CRM_Event_DAO_ParticipantStatusType {
/**
+ * @deprecated
* @param array $params
*
* @return self|null
*/
public static function add(&$params) {
- if (empty($params)) {
- return NULL;
- }
- $dao = new CRM_Event_DAO_ParticipantStatusType();
- $dao->copyValues($params);
- return $dao->save();
+ return self::writeRecord($params);
}
/**
+ * @deprecated
* @param array $params
*
* @return self|null
*/
- public static function &create(&$params) {
- $transaction = new CRM_Core_Transaction();
- $statusType = self::add($params);
- if (is_a($statusType, 'CRM_Core_Error')) {
- $transaction->rollback();
- return $statusType;
- }
- $transaction->commit();
- return $statusType;
+ public static function create(&$params) {
+ return self::writeRecord($params);
}
/**
'visibility_id' => 1,
];
- $statusType = CRM_Event_BAO_ParticipantStatusType::create($params);
+ $statusType = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);
// Checking for participant status type id in db.
$statusTypeId = $this->assertDBNotNull('CRM_Event_DAO_ParticipantStatusType', $statusType->id, 'id',
'id', 'Check DB for status type id'
];
// check for add participant status type
- $statusType = CRM_Event_BAO_ParticipantStatusType::add($params);
+ $statusType = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);
foreach ($params as $param => $value) {
$this->assertEquals($value, $statusType->$param);
}
];
// check for add participant status type
- $statusType = CRM_Event_BAO_ParticipantStatusType::add($params);
+ $statusType = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);
foreach ($params as $param => $value) {
$this->assertEquals($value, $statusType->$param);
}
'visibility_id' => 1,
];
- $statusType = CRM_Event_BAO_ParticipantStatusType::create($params);
+ $statusType = CRM_Event_BAO_ParticipantStatusType::writeRecord($params);
// retrieve status type
$retrieveParams = ['id' => $statusType->id];