public function ProductBundle::addBundleItem in Commerce Product Bundle 8
Adds a bundle item to the bundle.
Parameters
\Drupal\commerce_product_bundle\Entity\BundleItemInterface $bundle_item: The bundle item to add.
Return value
\Drupal\commerce_product_bundle\Entity\BundleInterface[] The called bundle entity.
Overrides BundleInterface::addBundleItem
File
- src/
Entity/ ProductBundle.php, line 225
Class
- ProductBundle
- Defines the product bundle entity.
Namespace
Drupal\commerce_product_bundle\EntityCode
public function addBundleItem(BundleItemInterface $bundle_item) {
if (!$this
->hasBundleItem($bundle_item)) {
$this
->get('bundle_items')
->appendItem($bundle_item);
}
return $this;
}