You are here

public function RestfulDataProviderEFQ::__construct in RESTful 7

Constructs a RestfulDataProviderEFQ object.

Parameters

array $plugin: Plugin definition.

RestfulAuthenticationManager $auth_manager: (optional) Injected authentication manager.

DrupalCacheInterface $cache_controller: (optional) Injected cache backend.

string $language: (optional) The language to return items in.

Throws

RestfulServerConfigurationException

Overrides RestfulBase::__construct

2 calls to RestfulDataProviderEFQ::__construct()
RestfulEntityBaseMultipleBundles::__construct in plugins/restful/RestfulEntityBaseMultipleBundles.php
Constructs a RestfulDataProviderEFQ object.
RestfulFilesUpload::__construct in plugins/restful/RestfulFilesUpload.php
Overrides \RestfulEntityBase::__construct()
2 methods override RestfulDataProviderEFQ::__construct()
RestfulEntityBaseMultipleBundles::__construct in plugins/restful/RestfulEntityBaseMultipleBundles.php
Constructs a RestfulDataProviderEFQ object.
RestfulFilesUpload::__construct in plugins/restful/RestfulFilesUpload.php
Overrides \RestfulEntityBase::__construct()

File

plugins/restful/RestfulDataProviderEFQ.php, line 75
Contains \RestfulDataProviderEFQ

Class

RestfulDataProviderEFQ
@file Contains \RestfulDataProviderEFQ

Code

public function __construct(array $plugin, \RestfulAuthenticationManager $auth_manager = NULL, \DrupalCacheInterface $cache_controller = NULL, $language = NULL) {
  parent::__construct($plugin, $auth_manager, $cache_controller, $language);
  $this->entityType = $plugin['entity_type'];
  $this->bundle = $plugin['bundle'];

  // Allow providing an alternative to \EntityFieldQuery.
  $data_provider_options = $this
    ->getPluginKey('data_provider_options');
  if (!empty($data_provider_options['efq_class'])) {
    if (!is_subclass_of($data_provider_options['efq_class'], '\\EntityFieldQuery')) {
      throw new \RestfulServerConfigurationException(format_string('The provided class @class does not extend from \\EntityFieldQuery.', array(
        '@class' => $data_provider_options['efq_class'],
      )));
    }
    $this->EFQClass = $data_provider_options['efq_class'];
  }
}