/** * Adds a persona to the current source description using a person object. * * @param Person $person * @param StateTransitionOption $option,... * * @return PersonState */ public function addPersonPersona(Person $person, StateTransitionOption $option = null) { $entity = new Gedcomx(); $entity->addPerson($person); return $this->passOptionsTo('addGedcomxPersona', array($entity), func_get_args()); }
/** * Adds a person to the current collection. * * @param Person|Gedcomx $person * @param StateTransitionOption $option,... * * @return PersonState|null */ public function addPerson($person, StateTransitionOption $option = null) { $link = $this->getLink(Rel::PERSONS); if ($link === null || $link->getHref() === null) { return null; } if ($person instanceof Person) { $entity = new Gedcomx(); $entity->addPerson($person); } else { $entity = $person; } $request = $this->createAuthenticatedGedcomxRequest("POST", $link->getHref(), array(), null, $entity->toJson()); return $this->stateFactory->createState('PersonState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Update this person with the current conclusion objects. * * @param \Gedcomx\Gedcomx|\Gedcomx\Conclusion\Person $obj * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @throws Exception\GedcomxApplicationException * @return \Gedcomx\Rs\Client\PersonState */ public function updateConclusions($obj, StateTransitionOption $option = null) { if ($obj instanceof Person) { $gx = new Gedcomx(); $gx->addPerson($obj); } else { if ($obj instanceof Gedcomx) { $gx = $obj; } else { throw new GedcomxApplicationException("Unsupported object type: " . get_class($obj)); } } $target = $this->getSelfUri(); $conclusionsLink = $this->getLink(Rel::CONCLUSIONS); if ($conclusionsLink != null && $conclusionsLink->getHref() != null) { $target = $conclusionsLink->getHref(); } $request = $this->createAuthenticatedGedcomxRequest('POST', $target, [], null, $gx->toJson()); return $this->stateFactory->createState("PersonState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Declares the specified search result entry as not a match for the current person. * * @param Entry $entry * @param StateTransitionOption $options * @return PersonNonMatchesState */ public function addNonMatch(Entry $entry, StateTransitionOption $options = null) { $link = $this->getLink(Rel::NOT_A_MATCHES); if ($link == null || $link->getHref() == null) { return null; } $entity = new Gedcomx(); $person = new Person(); $person->setId($entry->getId()); $entity->addPerson($person); $request = $this->createAuthenticatedRequest('POST', $link->getHref(), FamilySearchRequest::getMediaTypes(), null, $entity->toJson()); return $this->stateFactory->createState("PersonNonMatchesState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }