当前位置: 首页>>代码示例>>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;未经允许,请勿转载。