You are here

public function ProductBundle::removeBundleItem in Commerce Product Bundle 8

Removes a bundle item.

Parameters

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

Return value

$this

Overrides BundleInterface::removeBundleItem

File

src/Entity/ProductBundle.php, line 236

Class

ProductBundle
Defines the product bundle entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function removeBundleItem(BundleItemInterface $bundle_item) {
  $index = $this
    ->getBundleItemIndex($bundle_item);
  if ($index !== FALSE) {
    $this
      ->get('bundle_items')
      ->offsetUnset($index);
  }
  return $this;
}