You are here

public function InvoiceItem::getData in Commerce Invoice 8.2

Gets an invoice item data value with the given key.

Used to store temporary data.

Parameters

string $key: The key.

mixed $default: The default value.

Return value

mixed The value.

Overrides InvoiceItemInterface::getData

File

src/Entity/InvoiceItem.php, line 256

Class

InvoiceItem
Defines the invoice item entity class.

Namespace

Drupal\commerce_invoice\Entity

Code

public function getData($key, $default = NULL) {
  $data = [];
  if (!$this
    ->get('data')
    ->isEmpty()) {
    $data = $this
      ->get('data')
      ->first()
      ->getValue();
  }
  return isset($data[$key]) ? $data[$key] : $default;
}