當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Contact_DAO_Relationship::delete方法代碼示例

本文整理匯總了PHP中CRM_Contact_DAO_Relationship::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Contact_DAO_Relationship::delete方法的具體用法?PHP CRM_Contact_DAO_Relationship::delete怎麽用?PHP CRM_Contact_DAO_Relationship::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Contact_DAO_Relationship的用法示例。


在下文中一共展示了CRM_Contact_DAO_Relationship::delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteContact

 /**
  * Delete the object records that are associated with this contact.
  *
  * @param int $contactId
  *   Id of the contact to delete.
  */
 public static function deleteContact($contactId)
 {
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->contact_id_a = $contactId;
     $relationship->delete();
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->contact_id_b = $contactId;
     $relationship->delete();
     CRM_Contact_BAO_Household::updatePrimaryContact(NULL, $contactId);
 }
開發者ID:scardinius,項目名稱:civicrm-core,代碼行數:16,代碼來源:Relationship.php

示例2: del

 /**
  * Delete Relationship Types.
  *
  * @param int $relationshipTypeId
  *
  * @throws CRM_Core_Exception
  * @return mixed
  */
 public static function del($relationshipTypeId)
 {
     // make sure relationshipTypeId is an integer
     // @todo review this as most delete functions rely on the api & form layer for this
     // or do a find first & throw error if no find
     if (!CRM_Utils_Rule::positiveInteger($relationshipTypeId)) {
         throw new CRM_Core_Exception(ts('Invalid relationship type'));
     }
     //check dependencies
     // delete all relationships
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->relationship_type_id = $relationshipTypeId;
     $relationship->delete();
     // remove this relationship type from membership types
     $mems = civicrm_api3('MembershipType', 'get', array('relationship_type_id' => array('LIKE' => "%{$relationshipTypeId}%"), 'return' => array('id', 'relationship_type_id', 'relationship_direction')));
     foreach ($mems['values'] as $membershipTypeId => $membershipType) {
         $pos = array_search($relationshipTypeId, $membershipType['relationship_type_id']);
         // Api call may have returned false positives but currently the relationship_type_id uses
         // nonstandard serialization which makes anything more accurate impossible.
         if ($pos !== FALSE) {
             unset($membershipType['relationship_type_id'][$pos], $membershipType['relationship_direction'][$pos]);
             civicrm_api3('MembershipType', 'create', $membershipType);
         }
     }
     //fixed for CRM-3323
     $mappingField = new CRM_Core_DAO_MappingField();
     $mappingField->relationship_type_id = $relationshipTypeId;
     $mappingField->find();
     while ($mappingField->fetch()) {
         $mappingField->delete();
     }
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->id = $relationshipTypeId;
     return $relationshipType->delete();
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:43,代碼來源:RelationshipType.php

示例3: del

 /**
  * Function to delete Relationship Types
  *
  * @param int $relationshipTypeId
  * @static
  */
 static function del($relationshipTypeId)
 {
     // make sure relationshipTypeId is an integer
     if (!CRM_Utils_Rule::positiveInteger($relationshipTypeId)) {
         CRM_Core_Error::fatal(ts('Invalid relationship type'));
     }
     //check dependencies
     // delete all relationships
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->relationship_type_id = $relationshipTypeId;
     $relationship->delete();
     // set all membership_type to null
     $query = "\nUPDATE civicrm_membership_type\n  SET  relationship_type_id = NULL\n WHERE relationship_type_id = %1\n";
     $params = array(1 => array($relationshipTypeId, 'Integer'));
     CRM_Core_DAO::executeQuery($query, $params);
     //fixed for CRM-3323
     $mappingField = new CRM_Core_DAO_MappingField();
     $mappingField->relationship_type_id = $relationshipTypeId;
     $mappingField->find();
     while ($mappingField->fetch()) {
         $mappingField->delete();
     }
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->id = $relationshipTypeId;
     return $relationshipType->delete();
 }
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:32,代碼來源:RelationshipType.php

示例4: del

 /**
  * Function to delete Relationship Types
  *
  * @param int $relationshipTypeId
  * @static
  */
 static function del($relationshipTypeId)
 {
     // make sure relationshipTypeId is an integer
     // @todo review this as most delete functions rely on the api & form layer for this
     // or do a find first & throw error if no find
     if (!CRM_Utils_Rule::positiveInteger($relationshipTypeId)) {
         throw new CRM_Core_Exception(ts('Invalid relationship type'));
     }
     //check dependencies
     // delete all relationships
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->relationship_type_id = $relationshipTypeId;
     $relationship->delete();
     // set all membership_type to null
     $query = "\nUPDATE civicrm_membership_type\n  SET  relationship_type_id = NULL\n WHERE relationship_type_id = %1\n";
     $params = array(1 => array(CRM_Core_DAO::VALUE_SEPARATOR . $relationshipTypeId . CRM_Core_DAO::VALUE_SEPARATOR, 'String'));
     CRM_Core_DAO::executeQuery($query, $params);
     //fixed for CRM-3323
     $mappingField = new CRM_Core_DAO_MappingField();
     $mappingField->relationship_type_id = $relationshipTypeId;
     $mappingField->find();
     while ($mappingField->fetch()) {
         $mappingField->delete();
     }
     $relationshipType = new CRM_Contact_DAO_RelationshipType();
     $relationshipType->id = $relationshipTypeId;
     return $relationshipType->delete();
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:34,代碼來源:RelationshipType.php

示例5: deleteContact

 /**
  * Delete the object records that are associated with this contact
  *
  * @param  int  $contactId id of the contact to delete
  *
  * @return void
  * @access public
  * @static
  */
 static function deleteContact($contactId)
 {
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->contact_id_a = $contactId;
     $relationship->delete();
     $relationship = new CRM_Contact_DAO_Relationship();
     $relationship->contact_id_b = $contactId;
     $relationship->delete();
     require_once 'CRM/Contact/BAO/Household.php';
     CRM_Contact_BAO_Household::updatePrimaryContact(null, $contactId);
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:20,代碼來源:Relationship.php


注:本文中的CRM_Contact_DAO_Relationship::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。