But I'm finding that SimplePublicObjectInput is not a defined object. I'm not seeing anybody else with this issue, so I'm guessing I am overlooking something obvious! Here's my code snippet:
use HubSpot\Factory;
use HubSpot\Client\Crm\LineItems\ApiException;
class lineitem
{
private function hs_createNewTaxLineItem()
{
$client = Factory::createWithApiKey(HUBSPOT_API_KEY);
$properties = [
"hs_product_id" => HS_SALES_TAX_PRODUCT_ID,
"quantity" => "1",
"price" => 99.98
];
$SimplePublicObjectInput = new SimplePublicObjectInput(['properties' => $properties]);
try {
$apiResponse = $client->crm()->lineItems()->basicApi()->create($SimplePublicObjectInput);
var_dump($apiResponse);
} catch (ApiException $e) {
echo "Exception when calling basic_api->create: ", $e->getMessage();
}
}
It returns the error:
Fatal error: Uncaught Error: Class 'SimplePublicObjectInput' not found in...
Jul 14, 202210:28 AM - edited Jul 14, 202210:29 AM
Contributor
SimplePublicObjectInput Not Found
SOLVE
Yeah @MPenn6 I'm not speaking on behalf of HubSpot, using directly the appropriate namespace is the standard way to do it with the V3. Example for the contact :
$SimplePublicObjectInput = new \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput([ 'properties' => $properties ]);
I don't recommend to call it from the use statement as multiple models would probably create a conflict anyway. 😜 Anyone with more advanced skills is welcome to correct me 😊
And yeah that means all the PHP snippets provided from the documentation do not work if you just copy-paste them :
Jul 14, 202210:28 AM - edited Jul 14, 202210:29 AM
Contributor
SimplePublicObjectInput Not Found
SOLVE
Yeah @MPenn6 I'm not speaking on behalf of HubSpot, using directly the appropriate namespace is the standard way to do it with the V3. Example for the contact :
$SimplePublicObjectInput = new \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput([ 'properties' => $properties ]);
I don't recommend to call it from the use statement as multiple models would probably create a conflict anyway. 😜 Anyone with more advanced skills is welcome to correct me 😊
And yeah that means all the PHP snippets provided from the documentation do not work if you just copy-paste them :