/** * Creates a new Marriage record and refreshes the marrital status for both this person and the spouse * @param integer $intMarriageStatusTypeId (defaults to "Married") * @param Person $objSpouse the spouse * @param QDateTime $dttStartDate the start date of the marriage * @param QDateTime $dttEndDate the end date of the marriage * @return Marriage */ public function CreateMarriageWith(Person $objSpouse = null, QDateTime $dttStartDate = null, QDateTime $dttEndDate = null, $intMarriageStatusTypeId = MarriageStatusType::Married) { $objMarriage = new Marriage(); $objMarriage->Person = $this; $objMarriage->MarriedToPerson = $objSpouse; $objMarriage->MarriageStatusTypeId = $intMarriageStatusTypeId; $objMarriage->DateStart = $dttStartDate; $objMarriage->DateEnd = $dttEndDate; $objMarriage->Save(); // Updated Link record (if applicable) if ($objSpouse) { $objMarriage->UpdateLinkedMarriage(); } // Refresh Stats $this->RefreshMaritalStatusTypeId(); if ($objSpouse) { $objSpouse->RefreshMaritalStatusTypeId(); } return $objMarriage; }