You are here

protected function RestfulDataProviderDbQuery::getColumnFromIds in RESTful 7

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

Strings are divided by the delimiter self::COLUMN_IDS_SEPARATOR.

Parameters

array $ids: An array of object IDs.

int $column: 0-N Zero indexed

Return value

Array Returns an array at index $column

4 calls to RestfulDataProviderDbQuery::getColumnFromIds()
RestfulDataProviderDbQuery::getQueryCount in plugins/restful/RestfulDataProviderDbQuery.php
Prepare a query for RestfulEntityBase::getTotalCount().
RestfulDataProviderDbQuery::remove in plugins/restful/RestfulDataProviderDbQuery.php
Remove the item from the data source.
RestfulDataProviderDbQuery::update in plugins/restful/RestfulDataProviderDbQuery.php
Update an item based on the request object.
RestfulDataProviderDbQuery::viewMultiple in plugins/restful/RestfulDataProviderDbQuery.php
View a collection of items.

File

plugins/restful/RestfulDataProviderDbQuery.php, line 624
Contains \RestfulDataProviderDbQuery

Class

RestfulDataProviderDbQuery
@file Contains \RestfulDataProviderDbQuery

Code

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

  // Get a single column.
  return array_map(function ($id) use ($column) {
    $parts = explode(RestfulDataProviderDbQuery::COLUMN_IDS_SEPARATOR, $id);
    if (!isset($parts[$column])) {
      throw new \RestfulServerConfigurationException('Invalid ID provided.');
    }
    return $parts[$column];
  }, $ids);
}