Untitled
unknown
plain_text
2 years ago
1.5 kB
1
Indexable
Never
$theResourceObj = Invoice::create([ "Line" => [ [ "Amount" => 100.00, "DetailType" => "SalesItemLineDetail", "SalesItemLineDetail" => [ "ItemRef" => [ "value" => 1, "name" => "Services" ] ] ] ], "CustomerRef"=> [ "value"=> 1 ] ]); // Run a batch $batch = $dataService->CreateNewBatch(); $batch->AddQuery("select * from Customer startPosition 0 maxResults 5", "queryCustomer"); $batch->AddQuery("select * from Vendor startPosition 0 maxResults 5", "queryVendor"); $batch->AddEntity($theResourceObj, "CreateInvoice", "Create"); $batch->ExecuteWithRequestID("ThisIsMyFirstBatchRequest"); $error = $batch->getLastError(); if ($error) { echo "The Status code is: " . $error->getHttpStatusCode() . "\n"; echo "The Helper message is: " . $error->getOAuthHelperError() . "\n"; echo "The Response message is: " . $error->getResponseBody() . "\n"; exit(); } // Echo some formatted output $batchItemResponse_createInvoice = $batch->intuitBatchItemResponses["CreateInvoice"]; if($batchItemResponse_createInvoice->isSuccess()){ $createdInvoice = $batchItemResponse_createInvoice->getResult(); echo "Create Invoice success!:\n"; $xmlBody = XmlObjectSerializer::getPostXmlFromArbitraryEntity($createdInvoice, $something); echo $xmlBody . "\n"; }else{ $result = $batchItemResponse_createInvoice->getError(); var_dump($result); }