当前位置: 首页>>代码示例>>PHP>>正文


PHP Relationship::LoadByPersonIdRelatedToPersonId方法代码示例

本文整理汇总了PHP中Relationship::LoadByPersonIdRelatedToPersonId方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::LoadByPersonIdRelatedToPersonId方法的具体用法?PHP Relationship::LoadByPersonIdRelatedToPersonId怎么用?PHP Relationship::LoadByPersonIdRelatedToPersonId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Relationship的用法示例。


在下文中一共展示了Relationship::LoadByPersonIdRelatedToPersonId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: UpdateLinkedRelationship

 /**
  * Given this relationship record, this will update the "linked" relationship record with the same stats and details.
  * 
  * This will CREATE the Linked Relationship record if none yet exists.
  * 
  */
 public function UpdateLinkedRelationship()
 {
     $objPerson = $this->Person;
     $objRelatedPerson = $this->RelatedToPerson;
     $objLinkedRelationship = Relationship::LoadByPersonIdRelatedToPersonId($objRelatedPerson->Id, $objPerson->Id);
     if (!$objLinkedRelationship) {
         $objLinkedRelationship = new Relationship();
         $objLinkedRelationship->Person = $objRelatedPerson;
         $objLinkedRelationship->RelatedToPerson = $objPerson;
     }
     // Figure out the "Opposite" relationship to create
     switch ($this->intRelationshipTypeId) {
         case RelationshipType::Child:
             $objLinkedRelationship->RelationshipTypeId = RelationshipType::Parental;
             break;
         case RelationshipType::Parental:
             $objLinkedRelationship->RelationshipTypeId = RelationshipType::Child;
             break;
         case RelationshipType::Sibling:
             $objLinkedRelationship->RelationshipTypeId = RelationshipType::Sibling;
             break;
         case RelationshipType::Grandchild:
             $objLinkedRelationship->RelationshipTypeId = RelationshipType::Grandparent;
             break;
         case RelationshipType::Grandparent:
             $objLinkedRelationship->RelationshipTypeId = RelationshipType::Grandchild;
             break;
         default:
             throw new Exception('Invalid Relationship Type Id: ' . $intRelationshipTypeId);
     }
     $objLinkedRelationship->Save();
 }
开发者ID:alcf,项目名称:chms,代码行数:38,代码来源:Relationship.class.php

示例2: RefreshRole

 /**
  * Calculates the role value based on the person and his/her relationship to the head of household.
  * Will call save unless explicitly specified not to
  * @param boolean $blnSave whether or not to call save after updating role value
  * @return void
  */
 public function RefreshRole($blnSave = true)
 {
     $objHeadPerson = $this->Household->HeadPerson;
     if ($this->PersonId == $objHeadPerson->Id) {
         $this->strRole = 'Head';
         if ($blnSave) {
             $this->Save();
         }
         return;
     }
     // Calculate based on family relationships
     // Married?
     if (($objMarriage = $this->Person->GetMostRecentMarriage()) && $objMarriage->MarriageStatusTypeId == MarriageStatusType::Married && $objMarriage->MarriedToPersonId == $objHeadPerson->Id) {
         switch ($this->Person->Gender) {
             case 'M':
                 $this->strRole = 'Husband';
                 break;
             case 'F':
                 $this->strRole = 'Wife';
                 break;
             default:
                 $this->strRole = 'Spouse';
                 break;
         }
         if ($blnSave) {
             $this->Save();
         }
         return;
     }
     if ($objRelationship = Relationship::LoadByPersonIdRelatedToPersonId($objHeadPerson->Id, $this->Person->Id)) {
         $this->strRole = $objRelationship->Relation;
         if ($blnSave) {
             $this->Save();
         }
         return;
     }
     // Can't figure out any relationship -- simply specify as "Child" or "Adult"
     if ($this->Person->IsChild()) {
         $this->strRole = 'Child';
     } else {
         $this->strRole = 'Adult';
     }
     if ($blnSave) {
         $this->Save();
     }
     return;
 }
开发者ID:alcf,项目名称:chms,代码行数:53,代码来源:HouseholdParticipation.class.php

示例3:

            case 'daughter':
                $intRelationshipTypeId = RelationshipType::Child;
                break;
            case 'brother':
            case 'sister':
                $intRelationshipTypeId = RelationshipType::Sibling;
                break;
            case 'grandmother':
            case 'grandfather':
                $intRelationshipTypeId = RelationshipType::Grandparent;
                break;
            case 'grandchild':
            case 'grandson':
            case 'granddaughter':
                $intRelationshipTypeId = RelationshipType::Grandchild;
                break;
        }
        if ($intRelationshipTypeId) {
            $objPerson = Person::Load($intPersonIdByIndvId[$objRow['indvid']]);
            $objRelatedPerson = Person::Load($intPersonIdByIndvId[$objRow['reltindvid']]);
            if (!Relationship::LoadByPersonIdRelatedToPersonId($objPerson->Id, $objRelatedPerson->Id)) {
                $objPerson->AddRelationship($objRelatedPerson, $intRelationshipTypeId);
            }
        }
    }
}
$objParticipationCursor = HouseholdParticipation::QueryCursor(QQ::All());
$intCount = HouseholdParticipation::CountAll();
while (QDataGen::DisplayWhileTask('Recalculating HouseholdParticipation Roles', $intCount) && ($objHouseholdParticipation = HouseholdParticipation::InstantiateCursor($objParticipationCursor))) {
    $objHouseholdParticipation->RefreshRole();
}
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:acs-relationships.cli.php

示例4: MergeWith


//.........这里部分代码省略.........
         $objMembership->PersonId = $this->Id;
         $objMembership->Save();
     }
     // Communication Lists
     foreach ($objPersonMergeWith->GetCommunicationListArray() as $objCommList) {
         $objPersonMergeWith->UnassociateCommunicationList($objCommList);
         if (!$this->IsCommunicationListAssociated($objCommList)) {
             $this->AssociateCommunicationList($objCommList);
         }
     }
     // Head Shots
     foreach ($objPersonMergeWith->GetHeadShotArray() as $objHeadShot) {
         $objHeadShot->PersonId = $this->Id;
         $objHeadShot->Save();
     }
     // Group Participation
     foreach ($objPersonMergeWith->GetGroupParticipationArray() as $objGroupParticipation) {
         $objGroupParticipation->PersonId = $this->Id;
         $objGroupParticipation->Save();
     }
     // NameItemAssn
     $objPersonMergeWith->UnassociateAllNameItems();
     // Marrriage Records
     foreach ($objPersonMergeWith->GetMarriageArray() as $objMarriage) {
         $this->CreateMarriageWith($objMarriage->MarriedToPerson, $objMarriage->DateStart, $objMarriage->DateEnd, $objMarriage->MarriageStatusTypeId);
         $objMarriage->DeleteThisAndLinked();
     }
     foreach ($objPersonMergeWith->GetMarriageAsMarriedToArray() as $objMarriage) {
         $this->CreateMarriageWith($objMarriage->Person, $objMarriage->DateStart, $objMarriage->DateEnd, $objMarriage->MarriageStatusTypeId);
         $objMarriage->DeleteThisAndLinked();
     }
     // Family Relationships
     foreach ($objPersonMergeWith->GetRelationshipArray() as $objRelationship) {
         if (!Relationship::LoadByPersonIdRelatedToPersonId($this->Id, $objRelationship->RelatedToPersonId)) {
             $this->AddRelationship($objRelationship->RelatedToPerson, $objRelationship->RelationshipTypeId);
         }
         $objRelationship->DeleteThisAndLinked();
     }
     foreach ($objPersonMergeWith->GetRelationshipAsRelatedToArray() as $objRelationship) {
         if (!Relationship::LoadByPersonIdRelatedToPersonId($this->Id, $objRelationship->PersonId)) {
             $this->AddRelationship($objRelationship->Person, $objRelationship->RelationshipTypeId);
         }
         $objRelationship->DeleteThisAndLinked();
     }
     // Phones
     foreach ($objPersonMergeWith->GetPhoneArray() as $objContact) {
         $objContact->PersonId = $this->Id;
         $objContact->Save();
     }
     // Addresses
     foreach ($objPersonMergeWith->GetAddressArray() as $objContact) {
         $objContact->PersonId = $this->Id;
         $objContact->Save();
     }
     // Email
     foreach ($objPersonMergeWith->GetEmailArray() as $objContact) {
         $objContact->PersonId = $this->Id;
         $objContact->Save();
     }
     // Other Contact Info
     foreach ($objPersonMergeWith->GetOtherContactInfoArray() as $objContact) {
         $objContact->PersonId = $this->Id;
         $objContact->Save();
     }
     // Checking Account Lookups
     foreach ($objPersonMergeWith->GetCheckingAccountLookupArray() as $objCheckingAccount) {
开发者ID:alcf,项目名称:chms,代码行数:67,代码来源:Person.class.php


注:本文中的Relationship::LoadByPersonIdRelatedToPersonId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。