neclimdul/netsuite-search-iterator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

neclimdul/netsuite-search-iterator

最新稳定版本:v1.1.1

Composer 安装命令:

composer require neclimdul/netsuite-search-iterator

包简介

Library to help iterating search results in netsuite-php.

README 文档

README

This provides a native PHP iterator that allows for quick and easy integration with NetSuite's SOAP Search interface. This interface requires looping over paged results with a lot of boilerplate so this makes that process a lot easier and less error-prone.

Example:

<?php

$search = new ContactSearchBasic();
$search->email = new SearchStringField();
$search->email->operator = SearchStringFieldOperator::is;
$search->email->searchValue = 'joe@example.com';
$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
}

For loops are more than enough to interact with this iterator, but it can also be useful connected with a generator and the \nikic\iter library.

<?php
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 include in your search but easy to read.
$mylist = \iter\filter(fn($customer) => $customer->isActive, fetchCustomer('2020-09-09'));
foreach ($mylist as $customer) {
  print($customer->companyName);
}

统计信息

  • 总下载量: 397
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2022-06-07