Can't parse input object
Opened this issue · 0 comments
DAThosting commented
Hi there,
I know the project is a few years old but I get the following error in PHP 8:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught org\\nameapi\\client\\fault\\ServiceException: Unexpected late exception translation, caused by: Can't parse input object
My code looks like:
require_once( __DIR__ . '/vendor/optimaize/nameapi-client-php/src/org/nameapi/client/services/ServiceFactory.php');
use org\nameapi\ontology\input\context\Context;
use org\nameapi\ontology\input\context\Priority;
use org\nameapi\client\services\ServiceFactory;
use org\nameapi\ontology\input\entities\person\NaturalInputPerson;
use org\nameapi\ontology\input\entities\person\name\InputPersonName;
$context = Context::builder()
->place('US')
->priority(Priority::REALTIME())
->build();
$serviceFactory = new ServiceFactory('9f138864435cXXXXXXXXXXXXXXXXXXXX-user1', $context);
$personNameParser = $serviceFactory->parserServices()->personNameParser();
$inputPerson = NaturalInputPerson::builder()
->name(InputPersonName::westernBuilder()
->fullname( "John Doe" )
->build())
->build();
$parseResult = $personNameParser->parse($inputPerson);
var_dump($parseResult);
What am I doing wrong?