예제 #1
0
 /**
  * Get a RelationshipState associated with the relationship object.
  *
  * @param Relationship          $relationship
  * @param StateTransitionOption $option,...
  *
  * @return RelationshipState|null
  */
 public function readRelationship(Relationship $relationship, StateTransitionOption $option = null)
 {
     $link = $relationship->getLink(Rel::RELATIONSHIP);
     $link = $link == null ? $relationship->getLink(Rel::SELF) : $link;
     if ($link == null || $link->getHref() == null) {
         return null;
     }
     $request = $this->createAuthenticatedGedcomxRequest('GET', $link->getHref());
     return $this->stateFactory->createState('RelationshipState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken);
 }
예제 #2
0
 /**
  * Removes the specified relationship.
  *
  * @param \Gedcomx\Conclusion\Relationship                      $relationship
  * @param \Gedcomx\Rs\Client\Options\StateTransitionOption|null $option,...
  *
  * @return \Gedcomx\Rs\Client\RelationshipState
  * @throws \Gedcomx\Rs\Client\Exception\GedcomxApplicationException
  */
 public function removeRelationship(Relationship $relationship, StateTransitionOption $option = null)
 {
     $link = $relationship->getLink(Rel::RELATIONSHIP);
     if ($link == null) {
         $link = $relationship->getLink(Rel::SELF);
     }
     if ($link == null || $link->getHref() == null) {
         throw new GedcomxApplicationException("Unable to remove relationship: missing link.");
     }
     $request = $this->createAuthenticatedGedcomxRequest('DELETE', $link->getHref());
     return $this->stateFactory->createState("RelationshipState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken);
 }