commerce_amws-8.x-1.x-dev/modules/order/src/EntitySync/OrderItemClient.php

modules/order/src/EntitySync/OrderItemClient.php
<?php

namespace Drupal\commerce_amws_order\EntitySync;

use Drupal\commerce_amws\Api\ListClientInterface;
use Drupal\entity_sync\Client\ClientInterface as EntitySyncClientInterface;

/**
 * Entity Sync client adapter for order item-related requestes.
 */
class OrderItemClient implements EntitySyncClientInterface {

  /**
   * The API client.
   *
   * @var \KrystalCode\ApiIterator\ClientInterface
   */
  protected $client;

  /**
   * Costructs a new OrderItemClient object.
   *
   * @param \Drupal\commerce_amws\Api\ListClientInterface $client
   *   The API client.
   */
  public function __construct(ListClientInterface $client) {
    $this->client = $client;
  }

  /**
   * {@inheritdoc}
   */
  public function importList(array $filters = [], array $options = []) {
    return $this->client->list(
      ['limit' => $options['limit'] ?? ListClientInterface::DEFAULT_LIMIT],
      $options['parameters'] ?? []
    );
  }

  /**
   * {@inheritdoc}
   */
  public function importEntity($id) {
    throw new \Exception(
      'Importing an individual order item from Amazon MWS is not supported yet.'
    );
  }

  /**
   * {@inheritdoc}
   */
  public function create(array $fields) {
    throw new \Exception(
      'Creating an order item on Amazon MWS is not supported yet.'
    );
  }

  /**
   * {@inheritdoc}
   */
  public function update($id, array $fields) {
    throw new \Exception(
      'Updating an order item on Amazon MWS is not supported yet.'
    );
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc