You are here

protected function DataProvider::initResourceFieldCollection in RESTful 7.2

Initialize the empty resource field collection to bundle the output.

Parameters

mixed $identifier: The ID of thing being viewed.

Return value

ResourceFieldCollectionInterface The collection of fields.

Throws

\Drupal\restful\Exception\NotFoundException

4 calls to DataProvider::initResourceFieldCollection()
DataProviderDbQuery::mapDbRowToPublicFields in src/Plugin/resource/DataProvider/DataProviderDbQuery.php
DataProviderEntity::view in src/Plugin/resource/DataProvider/DataProviderEntity.php
Read operation.
DataProviderPlug::view in src/Plugin/resource/DataProvider/DataProviderPlug.php
Read operation.
DataProviderVariable::view in modules/restful_example/src/Plugin/resource/variables/DataProviderVariable.php
Read operation.

File

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

Class

DataProvider

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function initResourceFieldCollection($identifier) {
  $resource_field_collection = new ResourceFieldCollection(array(), $this
    ->getRequest());
  $interpreter = $this
    ->initDataInterpreter($identifier);
  $resource_field_collection
    ->setInterpreter($interpreter);
  $id_field_name = empty($this->options['idField']) ? 'id' : $this->options['idField'];
  $resource_field_collection
    ->setIdField($this->fieldDefinitions
    ->get($id_field_name));
  $resource_field_collection
    ->setResourceId($this->pluginId);
  return $resource_field_collection;
}