*
* @param int $entityRoleId
* ID of the EntityRole record to be deleted.
- *
+ * @deprecated
*/
public static function del($entityRoleId) {
- return parent::deleteRecord(['id' => $entityRoleId]);
+ return self::deleteRecord(['id' => $entityRoleId]);
}
}
* Delete name labels.
*
* @param int $printLabelId
- * ID of the name label to be deleted.
- *
+ * @deprecated
*/
public static function del($printLabelId) {
- $printLabel = new CRM_Core_DAO_PrintLabel();
- $printLabel->id = $printLabelId;
- $printLabel->delete();
+ self::deleteRecord(['id' => $printLabelId]);
}
/**
* Delete the campaign.
*
* @param int $id
- * Id of the campaign.
*
- * @return bool|mixed
+ * @deprecated
+ * @return bool|int
*/
public static function del($id) {
- if (!$id) {
+ try {
+ self::deleteRecord(['id' => $id]);
+ }
+ catch (CRM_Core_Exception $e) {
return FALSE;
}
-
- CRM_Utils_Hook::pre('delete', 'Campaign', $id);
-
- $dao = new CRM_Campaign_DAO_Campaign();
- $dao->id = $id;
- $result = $dao->delete();
-
- CRM_Utils_Hook::post('delete', 'Campaign', $id, $dao);
-
- return $result;
+ return 1;
}
/**
* Delete a Reminder.
*
* @param int $id
- * ID of the Reminder to be deleted.
- *
+ * @deprecated
* @throws CRM_Core_Exception
*/
public static function del($id) {
- if ($id) {
- $dao = new CRM_Core_DAO_ActionSchedule();
- $dao->id = $id;
- if ($dao->find(TRUE)) {
- $dao->delete();
- return;
- }
- }
- throw new CRM_Core_Exception(ts('Invalid value passed to delete function.'));
+ self::deleteRecord(['id' => $id]);
}
/**
* Delete the tag for a contact.
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
+ *
+ * WARNING: Nonstandard params searches by tag_id rather than id!
*/
public static function del(&$params) {
//invoke pre hook
* Function to delete scheduled job.
*
* @param $jobID
- * ID of the job to be deleted.
*
* @return bool|null
+ * @deprecated
* @throws CRM_Core_Exception
*/
public static function del($jobID) {
- if (!$jobID) {
- throw new CRM_Core_Exception(ts('Invalid value passed to delete function.'));
- }
-
- $dao = new CRM_Core_DAO_Job();
- $dao->id = $jobID;
- if (!$dao->find(TRUE)) {
- return NULL;
- }
-
- if ($dao->delete()) {
- return TRUE;
- }
+ self::deleteRecord(['id' => $jobID]);
+ return TRUE;
}
/**
* Delete the profile Field.
*
* @param int $id
- * Field Id.
- *
+ * @deprecated
* @return bool
- *
*/
public static function del($id) {
- //delete field field
- $field = new CRM_Core_DAO_UFField();
- $field->id = $id;
- $field->delete();
- return TRUE;
+ return (bool) self::deleteRecord(['id' => $id]);
}
/**
* Delete the mailing job.
*
* @param int $id
- * Mailing Job id.
- *
- * @return mixed
+ * @deprecated
+ * @return bool
*/
public static function del($id) {
- CRM_Utils_Hook::pre('delete', 'MailingJob', $id);
-
- $jobDAO = new CRM_Mailing_BAO_MailingJob();
- $jobDAO->id = $id;
- $result = $jobDAO->delete();
-
- CRM_Utils_Hook::post('delete', 'MailingJob', $jobDAO->id, $jobDAO);
-
- return $result;
+ return (bool) self::deleteRecord(['id' => $id]);
}
}
* Delete membership Blocks.
*
* @param int $id
- *
+ * @deprecated
* @return bool
*/
public static function del($id) {
- $dao = new CRM_Member_DAO_MembershipBlock();
- $dao->id = $id;
- $result = FALSE;
- if ($dao->find(TRUE)) {
- $dao->delete();
- $result = TRUE;
- }
- return $result;
+ return (bool) self::deleteRecord(['id' => $id]);
}
}
* Delete membership Payments.
*
* @param int $id
- *
+ * @deprecated
* @return bool
*/
public static function del($id) {
- $dao = new CRM_Member_DAO_MembershipPayment();
- $dao->id = $id;
- $result = FALSE;
- if ($dao->find(TRUE)) {
- $dao->delete();
- $result = TRUE;
- }
- return $result;
+ return (bool) self::deleteRecord(['id' => $id]);
}
}
* Delete pledge payment.
*
* @param int $id
- *
- * @return int
- * pledge payment id
+ * @deprecated
+ * @return bool
*/
public static function del($id) {
- $payment = new CRM_Pledge_DAO_PledgePayment();
- $payment->id = $id;
- if ($payment->find()) {
- $payment->fetch();
-
- CRM_Utils_Hook::pre('delete', 'PledgePayment', $id, $payment);
-
- $result = $payment->delete();
-
- CRM_Utils_Hook::post('delete', 'PledgePayment', $id, $payment);
-
- return $result;
- }
- else {
- return FALSE;
- }
+ return (bool) self::deleteRecord(['id' => $id]);
}
/**
* Delete the value.
*
* @param int $id
- * Id.
*
+ * @deprecated
* @return bool
- *
*/
public static function del($id) {
- if (!$id) {
- return FALSE;
- }
-
- $fieldValueDAO = new CRM_Price_DAO_PriceFieldValue();
- $fieldValueDAO->id = $id;
- return $fieldValueDAO->delete();
+ return (bool) self::deleteRecord(['id' => $id]);
}
/**