You are here

public function DataProviderDbQuery::getIndexIds in RESTful 7.2

Returns the ID to render for the current index GET request.

Return value

array Numeric array containing the identifiers to be sent to viewMultiple.

Overrides DataProviderInterface::getIndexIds

File

src/Plugin/resource/DataProvider/DataProviderDbQuery.php, line 354
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDbQuery.

Class

DataProviderDbQuery

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

public function getIndexIds() {
  $results = $this
    ->getQueryForList()
    ->execute();
  $ids = array();
  foreach ($results as $result) {
    $ids[] = array_map(function ($id_column) use ($result) {
      return $result->{$id_column};
    }, $this
      ->getIdColumn());
  }
  return $ids;
}