You are here

public function Payment::setLineItem in Payment 8.2

Sets a line item.

Parameters

\Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface $line_item:

Return value

static

Overrides LineItemCollectionInterface::setLineItem

1 call to Payment::setLineItem()
Payment::setLineItems in src/Entity/Payment.php
Sets line items.

File

src/Entity/Payment.php, line 151

Class

Payment
Defines a payment entity.

Namespace

Drupal\payment\Entity

Code

public function setLineItem(PaymentLineItemInterface $line_item) {
  $line_item
    ->setPayment($this);
  $this
    ->unsetLineItem($line_item
    ->getName());
  $this
    ->get('line_items')
    ->appendItem($line_item);
  return $this;
}