Example #1
0
 public function setSpouse(ClientAdditionalContact $spouse)
 {
     if ($spouse->getType() !== ClientAdditionalContact::TYPE_SPOUSE) {
         throw new \InvalidArgumentException(sprintf('Invalid client spouse type field value: %s', $spouse->getType()));
     }
     $currSpouse = $this->getSpouse();
     if ($currSpouse) {
         $currSpouse->setFirstName($spouse->getFirstName());
         $currSpouse->setMiddleName($spouse->getMiddleName());
         $currSpouse->setLastName($spouse->getLastName());
         $currSpouse->setBirthDate($spouse->getBirthDate());
     } else {
         $this->addAdditionalContact($spouse);
     }
     return $this;
 }