You are here

public function Payment::unsetLineItem in Payment 8.2

Unsets a line item.

Parameters

string $name: The line item's name.

Return value

static

Overrides LineItemCollectionInterface::unsetLineItem

1 call to Payment::unsetLineItem()
Payment::setLineItem in src/Entity/Payment.php
Sets a line item.

File

src/Entity/Payment.php, line 162

Class

Payment
Defines a payment entity.

Namespace

Drupal\payment\Entity

Code

public function unsetLineItem($name) {
  foreach ($this
    ->get('line_items') as $delta => $line_item_item) {
    if ($line_item_item
      ->getContainedPluginInstance()
      ->getName() == $name) {
      $this
        ->get('line_items')
        ->removeItem($delta);
    }
  }
  return $this;
}