/**
  * Constructor.
  *
  * @param RequestInterface $request
  *   The request.
  * @param ResourceFieldCollectionInterface $field_definitions
  *   The field definitions.
  * @param object $account
  *   The account object.
  * @param string $plugin_id
  *   The resource ID.
  * @param string $resource_path
  *   The resource path.
  * @param array $options
  *   The plugin definition options for the data provider.
  * @param string $langcode
  *   The entity language code.
  *
  * @throws InternalServerErrorException
  *   If there is no entity type.
  * @throws ServerConfigurationException
  *   If the field mappings are not for entities.
  */
 public function __construct(RequestInterface $request, ResourceFieldCollectionInterface $field_definitions, $account, $plugin_id, $resource_path, array $options, $langcode = NULL)
 {
     parent::__construct($request, $field_definitions, $account, $plugin_id, $resource_path, $options, $langcode);
     if (empty($options['entityType'])) {
         // Entity type is mandatory.
         throw new InternalServerErrorException('The entity type was not provided.');
     }
     $this->entityType = $options['entityType'];
     $options += array('bundles' => array());
     if ($options['bundles']) {
         $this->bundles = $options['bundles'];
     } elseif ($options['bundles'] !== FALSE) {
         // If no bundles are passed, then assume all the bundles of the entity
         // type.
         $entity_info = entity_get_info($this->entityType);
         $this->bundles = !empty($entity_info['bundles']) ? array_keys($entity_info['bundles']) : $entity_info['type'];
     }
     if (isset($options['EFQClass'])) {
         $this->EFQClass = $options['EFQClass'];
     }
     $this->setResourcePath($resource_path);
     if (empty($this->options['urlParams'])) {
         $this->options['urlParams'] = array('filter' => TRUE, 'sort' => TRUE, 'fields' => TRUE, 'loadByFieldName' => TRUE);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(RequestInterface $request, ResourceFieldCollectionInterface $field_definitions, $account, $plugin_id, $resource_path = NULL, array $options = array(), $langcode = NULL)
 {
     parent::__construct($request, $field_definitions, $account, $plugin_id, $resource_path, $options, $langcode);
     if (empty($this->options['urlParams'])) {
         $this->options['urlParams'] = array('filter' => TRUE, 'sort' => TRUE, 'fields' => TRUE);
     }
 }
 /**
  * Constructor.
  *
  * @param RequestInterface $request
  *   The request.
  * @param ResourceFieldCollectionInterface $field_definitions
  *   The field definitions.
  * @param object $account
  *   The authenticated account.
  * @param string $plugin_id
  *   The resource ID.
  * @param string $resource_path
  *   The resource path.
  * @param array $options
  *   The plugin options for the data provider.
  * @param string $langcode
  *   (Optional) The entity language code.
  * @param ResourceInterface $resource
  *   The referenced resource.
  */
 public function __construct(RequestInterface $request, ResourceFieldCollectionInterface $field_definitions, $account, $plugin_id, $resource_path, array $options, $langcode = NULL, ResourceInterface $resource = NULL)
 {
     $resource->setRequest($request);
     $this->resource = $resource;
     $this->referencedDataProvider = $resource->getDataProvider();
     parent::__construct($request, $field_definitions, $account, $plugin_id, $resource_path, $options, $langcode);
 }
 /**
  * {@inheritdoc}
  */
 public function __construct(RequestInterface $request, ResourceFieldCollectionInterface $field_definitions, $account, $plugin_id, $resource_path = NULL, array $options = array(), $langcode = NULL)
 {
     parent::__construct($request, $field_definitions, $account, $plugin_id, $resource_path, $options, $langcode);
     // Validate keys exist in the plugin's "data provider options".
     $required_keys = array('tableName', 'idColumn');
     $required_callback = function ($required_key) {
         if (!$this->options[$required_key]) {
             throw new ServiceUnavailableException(sprintf('%s is missing "%s" property in the "dataProvider" key of the $plugin', get_class($this), $required_key));
         }
     };
     array_walk($required_keys, $required_callback);
     $this->tableName = $this->options['tableName'];
     $this->idColumn = $this->options['idColumn'];
     $this->primary = empty($this->options['primary']) ? NULL : ($this->primary = $this->options['primary']);
 }