You are here

protected function DataProviderDbQuery::getColumnFromIds in RESTful 7.2

Given an array of string ID's return a single column.

Strings are divided by the delimiter self::COLUMN_IDS_SEPARATOR.

Parameters

array $identifiers: An array of object IDs.

int $column: 0-N Zero indexed

Return value

array Returns an array at index $column

4 calls to DataProviderDbQuery::getColumnFromIds()
DataProviderDbQuery::remove in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Delete operation.
DataProviderDbQuery::update in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Update operation.
DataProviderDbQuery::view in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Read operation.
DataProviderDbQuery::viewMultiple in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
Read operation.

File

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

Class

DataProviderDbQuery

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function getColumnFromIds(array $identifiers, $column = 0) {

  // Get a single column.
  $get_part = function ($identifier) use ($column) {
    $parts = explode(static::COLUMN_IDS_SEPARATOR, $identifier);
    if (!isset($parts[$column])) {
      throw new ServerConfigurationException('Invalid ID provided.');
    }
    return $parts[$column];
  };
  return array_map($get_part, $identifiers);
}