You are here

function commerce_recurring_load_by_order in Commerce Recurring Framework 7.2

Load all recurring entities in an order context.

Parameters

$order: Commerce order.

Return value

array

12 calls to commerce_recurring_load_by_order()
CommerceRecurringTestCase::testCommerceRecurringAnonymousOrder in tests/commerce_recurring.test
Test anonymous behaviour. Non-existing user
CommerceRecurringTestCase::testCommerceRecurringAnonymousOrderExistingUser in tests/commerce_recurring.test
Test anonymous behaviour. Existing user
CommerceRecurringTestCase::testCommerceRecurringCreatingRecurringEntityQuantity in tests/commerce_recurring.test
Test recurring entity creation with quantity.
CommerceRecurringTestCase::testCommerceRecurringEntityCreationWorkflow in tests/commerce_recurring.test
When creating an order and finish a payment, recurring entity
CommerceRecurringTestCase::testCommerceRecurringEntityCreationWorkflowNoInitialDate in tests/commerce_recurring.test
Test workflow with no initial date.

... See full list

File

./commerce_recurring.module, line 524
Commerce recurring module file.

Code

function commerce_recurring_load_by_order($order) {
  $return = array();
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'commerce_recurring')
    ->propertyCondition('status', TRUE)
    ->fieldCondition('commerce_recurring_order', 'target_id', $order->order_id);
  $result = $query
    ->execute();
  if (!empty($result['commerce_recurring'])) {
    foreach ($result['commerce_recurring'] as $recurring) {
      $return[] = entity_load_single('commerce_recurring', $recurring->id);
    }
  }
  return $return;
}