public function InvoiceStorage::loadByOrders in Commerce Invoice 8.2
Loads one or more invoices that are attached to the given orders.
Parameters
string $invoice_type: The invoice type.
\Drupal\commerce_order\Entity\OrderInterface[] $orders: An array of order entities.
Return value
\Drupal\commerce_invoice\Entity\InvoiceInterface[] The invoices attached to the given order.
File
- src/
InvoiceStorage.php, line 123
Class
Namespace
Drupal\commerce_invoiceCode
public function loadByOrders($invoice_type, array $orders) {
$order_ids = array_map(function (OrderInterface $order) {
return $order
->id();
}, $orders);
return $this
->loadByProperties([
'type' => $invoice_type,
'orders' => $order_ids,
]);
}