You are here

public function Resource::dataProviderFactory in RESTful 7.2

Data provider factory.

Return value

DataProviderInterface The data provider for this resource.

Throws

NotImplementedException

ServerConfigurationException

Overrides ResourceInterface::dataProviderFactory

1 call to Resource::dataProviderFactory()
Resource::getDataProvider in src/Plugin/resource/Resource.php
Gets the data provider.
1 method overrides Resource::dataProviderFactory()
ResourceEntity::dataProviderFactory in src/Plugin/resource/ResourceEntity.php
Data provider factory.

File

src/Plugin/resource/Resource.php, line 95
Contains \Drupal\restful\Plugin\resource\Resource.

Class

Resource

Namespace

Drupal\restful\Plugin\resource

Code

public function dataProviderFactory() {
  $plugin_definition = $this
    ->getPluginDefinition();
  $field_definitions = $this
    ->getFieldDefinitions();
  $class_name = $this
    ->dataProviderClassName();
  if (!class_exists($class_name)) {
    throw new ServerConfigurationException(sprintf('The DataProvider could not be found for this resource: %s.', $this
      ->getResourceMachineName()));
  }
  return new $class_name($this
    ->getRequest(), $field_definitions, $this
    ->getAccount(), $this
    ->getPluginId(), $this
    ->getPath(), $plugin_definition['dataProvider']);
}