You are here

public function ShipmentItem::toArray in Commerce Shipping 8.2

Same name in this branch
  1. 8.2 src/ShipmentItem.php \Drupal\commerce_shipping\ShipmentItem::toArray()
  2. 8.2 src/Plugin/DataType/ShipmentItem.php \Drupal\commerce_shipping\Plugin\DataType\ShipmentItem::toArray()

Gets the array representation of the shipment item.

Return value

array The array representation of the shipment item.

File

src/ShipmentItem.php, line 157

Class

ShipmentItem
Represents a shipment item.

Namespace

Drupal\commerce_shipping

Code

public function toArray() {
  return [
    'order_item_id' => $this
      ->getOrderItemId(),
    'title' => $this
      ->getTitle(),
    'quantity' => $this
      ->getQuantity(),
    'weight' => $this
      ->getWeight()
      ->toArray(),
    'declared_value' => $this
      ->getDeclaredValue()
      ->toArray(),
    'tariff_code' => $this
      ->getTariffCode(),
  ];
}