You are here

protected function TransactionListBuilder::getEntityIds in Transaction 8

Loads entity IDs using a pager sorted by the entity id.

Return value

array An array of entity IDs.

Overrides EntityListBuilder::getEntityIds

File

src/TransactionListBuilder.php, line 120

Class

TransactionListBuilder
Provides a entity list page for transactions.

Namespace

Drupal\transaction

Code

protected function getEntityIds() {
  $query = $this
    ->getStorage()
    ->getQuery()
    ->sort('execution_sequence', 'DESC')
    ->sort('executed', 'DESC')
    ->sort('created', 'DESC');
  if ($this->transactionType) {
    $query
      ->condition('type', $this->transactionType
      ->id());
  }
  if ($this->targetEntity) {
    $query
      ->condition('target_entity.target_id', $this->targetEntity
      ->id())
      ->condition('target_entity.target_type', $this->transactionType
      ->getTargetEntityTypeId());
  }

  // Only add the pager if a limit is specified.
  if ($this->limit) {
    $query
      ->pager($this->limit);
  }
  return $query
    ->execute();
}