/** * Adds a source description the current collection of source descriptions. * * @param \Gedcomx\Source\SourceDescription $source * @param Options\StateTransitionOption $option,... * * @return SourceDescriptionState|null */ public function addSourceDescription(SourceDescription $source, StateTransitionOption $option = null) { $entity = new Gedcomx(); $entity->addSourceDescription($source); $request = $this->createAuthenticatedGedcomxRequest('POST', $this->getSelfUri(), [], null, $entity->toJson()); return $this->stateFactory->createState('SourceDescriptionState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Adds a source description to the current collection. * * @param SourceDescription $source * @param StateTransitionOption $option,... * * @throws GedcomxApplicationException * @return SourceDescriptionState|null */ public function addSourceDescription(SourceDescription $source, StateTransitionOption $option = null) { $link = $this->getLink(Rel::SOURCE_DESCRIPTIONS); if ($link == null || $link->getHref() == null) { throw new GedcomxApplicationException(sprintf("Collection at %s doesn't support adding source descriptions.", getUri())); } $entity = new Gedcomx(); $entity->addSourceDescription($source); $request = $this->createAuthenticatedGedcomxRequest('POST', $link->getHref(), [], null, $entity->toJson()); return $this->stateFactory->createState("SourceDescriptionState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }