You are here

public function Resource::setRequest in RESTful 7.2

Sets the request object.

Parameters

RequestInterface $request: The request object.

Overrides ResourceInterface::setRequest

3 calls to Resource::setRequest()
Resource::doDelete in src/Plugin/resource/Resource.php
Shorthand method to perform a quick DELETE request.
Resource::doGet in src/Plugin/resource/Resource.php
Shorthand method to perform a quick GET request.
Resource::doWrite in src/Plugin/resource/Resource.php

File

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

Class

Resource

Namespace

Drupal\restful\Plugin\resource

Code

public function setRequest(RequestInterface $request) {
  $this->request = $request;

  // Make sure that the request is updated in the data provider.
  $this
    ->getDataProvider()
    ->setRequest($request);
  foreach ($this->fieldDefinitions as $resource_field) {

    /* @var \Drupal\restful\Plugin\resource\Field\ResourceFieldInterface $resource_field */
    $resource_field
      ->setRequest($request);
  }
}