/** * Adds a child and parents relationship to the current relationships collection. * * @param \Gedcomx\Extensions\FamilySearch\Platform\Tree\ChildAndParentsRelationship $chap * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @return mixed */ public function addChildAndParentsRelationship(ChildAndParentsRelationship $chap, StateTransitionOption $option = null) { $entity = new FamilySearchPlatform(); $entity->setChildAndParentsRelationships(array($chap)); $request = $this->createAuthenticatedRequest('POST', $this->getSelfUri()); return $this->stateFactory->createState('ChildAndParentsRelationshipState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Add a list of ChildAndParentsRelationships to the collection * * @param \Gedcomx\Extensions\FamilySearch\Platform\Tree\ChildAndParentsRelationship[] $chaps * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @return \Gedcomx\Rs\Client\RelationshipsState * @throws GedcomxApplicationException */ public function addChildAndParentsRelationships(array $chaps, StateTransitionOption $option = null) { $link = $this->getLink(Rel::RELATIONSHIPS); if ($link == null || $link->getHref() == null) { throw new GedcomxApplicationException(sprintf("FamilySearch Family Tree at %s didn't provide a 'relationships' {$link}->", $this->getUri())); } $entity = new FamilySearchPlatform(); $entity->setChildAndParentsRelationships($chaps); $request = $this->createAuthenticatedRequest('POST', $link->getHref(), FamilySearchRequest::getMediaTypes(), null, $entity->toJson()); return $this->stateFactory->createState('RelationshipsState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Update a relationship passing in a Rel link to specify what needs to be updated. * * @param \Gedcomx\Extensions\FamilySearch\Platform\Tree\ChildAndParentsRelationship $relationship * @param string $rel * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @return ChildAndParentsRelationshipState */ protected function updateRelationship(ChildAndParentsRelationship $relationship, $rel, StateTransitionOption $option = null) { $target = $this->getSelfUri(); $link = $this->getLink($rel); if ($link != null && $link->getHref() != null) { $target = $link->getHref(); } $gx = new FamilySearchPlatform(); $gx->setChildAndParentsRelationships(array($relationship)); $request = $this->createAuthenticatedRequest('POST', $target, FamilySearchRequest::getMediaTypes(), null, $gx->toJson()); return $this->stateFactory->createState('ChildAndParentsRelationshipState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }