protected function Subscription::getOrderIndex in Commerce Recurring Framework 8
Gets the index of the given recurring order.
Parameters
\Drupal\commerce_order\Entity\OrderInterface $order: The recurring order.
Return value
int|bool The index of the given recurring order, or FALSE if not found.
2 calls to Subscription::getOrderIndex()
- Subscription::hasOrder in src/
Entity/ Subscription.php - Checks whether the order has a given recurring order.
- Subscription::removeOrder in src/
Entity/ Subscription.php - Removes a recurring order.
File
- src/
Entity/ Subscription.php, line 397
Class
- Subscription
- Defines the subscription entity.
Namespace
Drupal\commerce_recurring\EntityCode
protected function getOrderIndex(OrderInterface $order) {
$values = $this
->get('orders')
->getValue();
$order_ids = array_map(function ($value) {
return $value['target_id'];
}, $values);
return array_search($order
->id(), $order_ids);
}