You are here

public function ProductBundle::hasBundleItem in Commerce Product Bundle 8

Checks whether the bundle has a given bundle item.

Parameters

\Drupal\commerce_product_bundle\Entity\BundleItemInterface $bundle_item: The bundle item to check for.

Return value

bool True if the given bundle item is referenced, false otherwise.

Overrides BundleInterface::hasBundleItem

1 call to ProductBundle::hasBundleItem()
ProductBundle::addBundleItem in src/Entity/ProductBundle.php
Adds a bundle item to the bundle.

File

src/Entity/ProductBundle.php, line 268

Class

ProductBundle
Defines the product bundle entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function hasBundleItem(BundleItemInterface $bundle_item) {
  return in_array($bundle_item
    ->id(), $this
    ->getBundleItemIds());
}