You are here

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

modules/restful_example/src/Plugin/resource/variables/DataProviderVariable.php, line 97
Contains \Drupal\restful_example\Plugin\resource\variables\DataProviderVariable.

Class

DataProviderVariable
Class DataProviderVariable.

Namespace

Drupal\restful_example\Plugin\resource\variables

Code

public function viewMultiple(array $identifiers) {
  $return = array();
  foreach ($identifiers as $identifier) {
    try {
      $row = $this
        ->view($identifier);
    } catch (InaccessibleRecordException $e) {
      $row = NULL;
    }
    $return[] = $row;
  }
  return array_values(array_filter($return));
}