You are here

public function CacheDecoratedDataProvider::viewMultiple in RESTful 7.2

Read operation.

Parameters

array $identifiers: The array of IDs of things being viewed.

Return value

array An array of structured data for the things being viewed.

Overrides CrudInterface::viewMultiple

1 call to CacheDecoratedDataProvider::viewMultiple()
CacheDecoratedDataProvider::index in src/Plugin/resource/DataProvider/CacheDecoratedDataProvider.php
List operation.

File

src/Plugin/resource/DataProvider/CacheDecoratedDataProvider.php, line 197
Contains \Drupal\restful\Plugin\resource\DataProvider\CacheDecoratedDataProvider.

Class

CacheDecoratedDataProvider
Class CacheDecoratedDataProvider.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

public function viewMultiple(array $identifiers) {
  $return = array();

  // If no IDs were requested, we should not throw an exception in case an
  // entity is un-accessible by the user.
  foreach ($identifiers as $identifier) {
    try {
      $row = $this
        ->view($identifier);
    } catch (InaccessibleRecordException $e) {
      $row = NULL;
    }
    $return[] = $row;
  }
  return array_values(array_filter($return));
}