PHP code example of neclimdul / netsuite-search-iterator

1. Go to this page and download the library: Download neclimdul/netsuite-search-iterator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

neclimdul / netsuite-search-iterator example snippets




$search = new ContactSearchBasic();
$search->email = new SearchStringField();
$search->email->operator = SearchStringFieldOperator::is;
$search->email->searchValue = '[email protected]';
$iterator = new SearchIterator($service, $search, Contact::class, 20);
try {
  foreach ($iterator as $record) {
    // process results
  }
}
catch (\SoapFault $e) {
  // Handle exception
}
catch (\NecLimDul\NetSuiteSearchIterator\Exception\StatusFailure $e) {
  // Handle exception
}


fetchCustomer($date) {
  $search = new CustomerSearchBasic();
  $search->lastModifiedDate = new SearchDateField();
  $search->lastModifiedDate->operator = SearchDateFieldOperator::after;
  $search->lastModifiedDate->searchValue = date(DATE_ISO8601, $date);
  $iterator = new SearchIterator($service, $search);
  foreach ($iterator as $record) {
    yield convertCustomer($record);
  }
}
// This is a pretty weird filter not to