You are here

public static function Shipment::loadByOrder in Ubercart 8.4

Loads a shipment and its packages for a given order.

Parameters

int $orderId: An order ID.

Return value

\Drupal\uc_fulfillment\Shipment[] Array of shipment objects for the given order.

4 calls to Shipment::loadByOrder()
ShipmentController::listOrderShipments in shipping/uc_fulfillment/src/Controller/ShipmentController.php
Displays a list of shipments for an order.
Tracking::view in shipping/uc_fulfillment/src/Plugin/Ubercart/OrderPane/Tracking.php
Returns the contents of an order pane as a store administrator.
uc_fulfillment_tokens in shipping/uc_fulfillment/uc_fulfillment.tokens.inc
Implements hook_tokens().
uc_fulfillment_uc_order_delete in shipping/uc_fulfillment/uc_fulfillment.module
Implements hook_uc_order_delete().

File

shipping/uc_fulfillment/src/Shipment.php, line 375

Class

Shipment
Defines the Shipment class.

Namespace

Drupal\uc_fulfillment

Code

public static function loadByOrder($orderId) {
  $shipments = [];
  $result = \Drupal::database()
    ->query('SELECT sid FROM {uc_shipments} WHERE order_id = :id', [
    ':id' => $orderId,
  ]);
  while ($shipment_id = $result
    ->fetchField()) {
    $shipments[] = Shipment::load($shipment_id);
  }
  return $shipments;
}