/**
* @param array $items
*/
public function write(array $items)
{
// file_put_contents('options.json', json_encode($items));
foreach ($items as $item) {
try {
$this->webservice->sendAttributeOption($item);
} catch (\Exception $e) {
$event = new InvalidItemEvent(__CLASS__, $e->getMessage(), array(), ['code' => key($item)]);
// Logging file
$this->eventDispatcher->dispatch(EventInterface::INVALID_ITEM, $event);
// Loggin Interface
$this->stepExecution->addWarning(__CLASS__, $e->getMessage(), array(), ['code' => key($item)]);
/** @var ClientErrorResponseException $e */
if ($e->getResponse()->getStatusCode() <= 404) {
$e = new \Exception($e->getResponse()->getReasonPhrase());
$this->stepExecution->addFailureException($e);
$exitStatus = new ExitStatus(ExitStatus::FAILED);
$this->stepExecution->setExitStatus($exitStatus);
}
// Handle next element.
}
$this->stepExecution->incrementWriteCount();
$this->stepExecution->incrementSummaryInfo('write');
}
}