You are here

public function DataProviderEntity::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

File

src/Plugin/resource/DataProvider/DataProviderEntity.php, line 270
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.

Class

DataProviderEntity
Class DataProviderEntity.

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));
}