public function DataProviderDbQuery::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/ DataProviderDbQuery.php, line 257 - Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDbQuery.
Class
Namespace
Drupal\restful\Plugin\resource\DataProviderCode
public function viewMultiple(array $identifiers) {
// Get a list query with all the sorting and pagination in place.
$query = $this
->getQueryForList();
if (empty($identifiers)) {
return array();
}
foreach ($this
->getIdColumn() as $index => $column) {
$query
->condition($this
->getTableName() . '.' . $column, $this
->getColumnFromIds($identifiers, $index), 'IN');
}
$results = $query
->execute();
$return = array();
foreach ($results as $result) {
$return[] = $this
->mapDbRowToPublicFields($result);
}
return $return;
}