本文整理匯總了PHP中Batch::setCompanyId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Batch::setCompanyId方法的具體用法?PHP Batch::setCompanyId怎麽用?PHP Batch::setCompanyId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Batch
的用法示例。
在下文中一共展示了Batch::setCompanyId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testBatchFile
function testBatchFile()
{
global $client;
$batchID = 0;
$uploadedFilePath = "";
//BatchSave
$batch = new Batch();
$batch->setBatchStatusId("Waiting");
$batch->setBatchTypeId("ItemImport");
$batch->setCompanyId(31115);
$batch->setName("ItemImportTest.xls");
$batch->setOptions("Add File");
$batchFile = new BatchFile();
$batchFile->setName("ItemImportTest.xls");
$filename = "c:\\Batch\\ItemImportTest.xls";
$contents = $this->ReadContents($filename);
$batchFile->setFilePath($filename);
$batchFile->setSize(strlen($contents));
$batchFile->setContent($contents);
$batchFiles = array($batchFile);
$batch->setFiles($batchFiles);
$batchSaveResult = $client->BatchSave($batch);
$this->assertEqual(SeverityLevel::$Success, $batchSaveResult->getResultCode());
$batchID = $batchSaveResult->getBatchId();
//BatchFileSave- save BatchFile in that BAtchFile only
$file = new BatchFile();
//Set BatchId for recently stored batch
$file->setBatchId($batchID);
$file->setName("Error.xls");
$file->setSize(100);
$file->setContentType("content type");
$filename = "c:\\Batch\\Errors.xls";
$contents = $this->ReadContents($filename);
$file->setContent($contents);
$fileSaveResult = $client->BatchFileSave($file);
$this->assertEqual(SeverityLevel::$Success, $fileSaveResult->getResultCode());
//BatchFileFetch
$fetchRequest = new FetchRequest();
$fetchRequest->setFields("*,Content");
$fetchRequest->setFilters("BatchFileId=" . $fileSaveResult->getBatchFileId());
$batchFileFetchResult = $client->BatchFileFetch($fetchRequest);
$this->assertEqual(SeverityLevel::$Success, $batchFileFetchResult->getResultCode());
foreach ($batchFileFetchResult->getBatchFiles() as $batchFile) {
$this->assertEqual("Error.xls", $batchFile->getName());
}
//BatchFile delete
$delRequest = new DeleteRequest();
$delRequest->setFilters("BatchFileId=" . $fileSaveResult->getBatchFileId());
$delRequest->setMaxCount(1);
$delResult = $client->BatchFileDelete($delRequest);
$this->assertEqual(SeverityLevel::$Success, $delResult->getResultCode());
//Batch Delete
$delRequest = new DeleteRequest();
$delRequest->setFilters("BatchId=" . $batchID);
$delResult = $client->BatchDelete($delRequest);
$this->assertEqual(SeverityLevel::$Success, $delResult->getResultCode());
}