You are here

public function PromotionUsage::load in Commerce Core 8.2

Loads the usage for the given promotion.

The optional $mail parameter can be used to restrict the usage count to a specific customer email.

Parameters

\Drupal\commerce_promotion\Entity\PromotionInterface $promotion: The promotion.

string $mail: (Optional) The customer email.

Return value

int The usage.

Overrides PromotionUsageInterface::load

File

modules/promotion/src/PromotionUsage.php, line 75

Class

PromotionUsage

Namespace

Drupal\commerce_promotion

Code

public function load(PromotionInterface $promotion, $mail = NULL) {
  $usages = $this
    ->loadMultiple([
    $promotion,
  ], $mail);
  return $usages[$promotion
    ->id()];
}