You are here

public function LibraryItem::getLatestTransaction in Library 8

Get the latest transaction.

Return value

array Latest transaction.

File

src/Entity/LibraryItem.php, line 214

Class

LibraryItem
Defines the Library item entity.

Namespace

Drupal\library\Entity

Code

public function getLatestTransaction() {
  $transaction = \Drupal::entityQuery('library_transaction')
    ->condition('library_item', $this
    ->id())
    ->sort('id', 'DESC')
    ->range(0, 1)
    ->execute();
  return $transaction;
}