You are here

protected function ProductBundleItem::hasVariation in Commerce Product Bundle 8

Whether the bundle item has a specific variation referenced.

Parameters

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

Return value

bool True if the variations reference contains the variation, false otherwise.

2 calls to ProductBundleItem::hasVariation()
ProductBundleItem::addVariation in src/Entity/ProductBundleItem.php
Adds a variation.
ProductBundleItem::setCurrentVariation in src/Entity/ProductBundleItem.php
Gets the currently selected variation, or the default variation.

File

src/Entity/ProductBundleItem.php, line 335

Class

ProductBundleItem
Defines the product bundle item entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

protected function hasVariation(ProductVariationInterface $variation) {
  return $this
    ->getVariationIndex($variation) !== FALSE;
}