/** * @vcr SearchAndMatchTests/testSearchForPersonMatches.json * @link https://familysearch.org/developers/docs/api/tree/Search_Persons_With_Warnings_and_Errors_usecase */ public function testSearchForPersonMatches() { $factory = new FamilyTreeStateFactory(); $collection = $this->collectionState($factory); $query = new GedcomxPersonSearchQueryBuilder(); $query->fatherSurname("Heaton")->spouseSurname("Cox")->surname("Heaton")->givenName("Israel")->birthPlace("Orderville, UT")->deathDate("29 August 1936")->deathPlace("Kanab, Kane, UT")->spouseGivenName("Charlotte")->motherGivenName("Clarissa")->motherSurname("Hoyt")->gender("Male")->birthDate("30 January 1880")->fatherGivenName("Jonathan"); $state = $collection->searchForPersonMatches($query, QueryParameter::count(2)); $this->assertNotNull($state->ifSuccessful()); $this->assertEquals(HttpStatus::OK, $state->getStatus()); $this->assertNotNull($state->getResults()); $this->assertNotNull($state->getResults()->getEntries()); $this->assertGreaterThan(0, count($state->getResults()->getEntries())); }
/** * Searches for person matches based off the specified query. * * @param GedcomxPersonSearchQueryBuilder|string $query * @param StateTransitionOption $option,... * * @return PersonMatchResultsState */ public function searchForPersonMatches($query, StateTransitionOption $option = null) { $link = $this->getLink(Rel::PERSON_MATCHES_QUERY); if ($link == null || $link->getTemplate() == null) { return null; } if ($query instanceof GedcomxPersonSearchQueryBuilder) { $queryString = $query->build(); } else { $queryString = $query; } $uri = array($link->getTemplate(), array("q" => $queryString)); $request = $this->createAuthenticatedFeedRequest('GET', $uri); return $this->stateFactory->createState('PersonMatchResultsState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }