You are here

private static function CommerceExampleOrderMigration::seekLineItems in Commerce Migrate 7

Returns line items IDs for the order.

Parameters

string|int $order_id: The ID of an order.

Return value

array[] Value for a "commerce_line_items" field.

1 call to CommerceExampleOrderMigration::seekLineItems()
CommerceExampleOrderMigration::prepare in commerce_migrate_example/migrations/order.inc

File

commerce_migrate_example/migrations/order.inc, line 78
Import orders and attach line items with products to them.

Class

CommerceExampleOrderMigration
Class CommerceExampleOrderMigration.

Code

private static function seekLineItems($order_id) {
  $line_items = array();

  // The line items migration ain't have stub creation
  // because we aren't interested in orders with stub.
  $line_item_ids = db_select('commerce_line_item', 'cli')
    ->fields('cli', array(
    'line_item_id',
  ))
    ->condition('order_id', $order_id)
    ->execute()
    ->fetchCol();
  foreach ($line_item_ids as $line_item_id) {
    $line_items[] = array(
      'line_item_id' => $line_item_id,
    );
  }
  return $line_items;
}