You are here

public static function Main__1_8::randomRelationship in RESTful 7.2

Returns a random relationship.

This serves as an example of a use case for the generic relationship.

Parameters

DataInterpreterInterface $interpreter: The data interpreter.

Return value

mixed The embeddable result.

File

tests/modules/restful_test/src/Plugin/resource/entity_test/main/v1/Main__1_8.php, line 66
Contains \Drupal\restful_test\Plugin\resource\entity_test\main\v1\Main__1_8.

Class

Main__1_8
Class Main__1_8.

Namespace

Drupal\restful_test\Plugin\resource\entity_test\main\v1

Code

public static function randomRelationship(DataInterpreterInterface $interpreter) {

  /* @var \Drupal\restful\Plugin\resource\ResourceInterface $handler */
  $handler = restful()
    ->getResourceManager()
    ->getPlugin('db_query_test:1.0');

  // This simbolizes some complex logic that gets a rendered resource.
  $id = static::complexCalculation();
  return $handler
    ->getDataProvider()
    ->view($id);
}