You are here

protected function Product::getVariationIndex in Commerce Core 8.2

Gets the index of the given variation.

Parameters

\Drupal\commerce_product\Entity\ProductVariationInterface $variation: The variation.

Return value

int|bool The index of the given variation, or FALSE if not found.

1 call to Product::getVariationIndex()
Product::removeVariation in modules/product/src/Entity/Product.php
Removes a variation.

File

modules/product/src/Entity/Product.php, line 230

Class

Product
Defines the product entity class.

Namespace

Drupal\commerce_product\Entity

Code

protected function getVariationIndex(ProductVariationInterface $variation) {
  return array_search($variation
    ->id(), $this
    ->getVariationIds());
}