You are here

public function PositionResource::get in Migrate Plus 8

Same name and namespace in other branches
  1. 8.5 migrate_example_advanced/migrate_example_advanced_setup/src/Plugin/rest/resource/PositionResource.php \Drupal\migrate_example_advanced_setup\Plugin\rest\resource\PositionResource::get()
  2. 8.2 migrate_example_advanced/migrate_example_advanced_setup/src/Plugin/rest/resource/PositionResource.php \Drupal\migrate_example_advanced_setup\Plugin\rest\resource\PositionResource::get()
  3. 8.3 migrate_example_advanced/migrate_example_advanced_setup/src/Plugin/rest/resource/PositionResource.php \Drupal\migrate_example_advanced_setup\Plugin\rest\resource\PositionResource::get()
  4. 8.4 migrate_example_advanced/migrate_example_advanced_setup/src/Plugin/rest/resource/PositionResource.php \Drupal\migrate_example_advanced_setup\Plugin\rest\resource\PositionResource::get()

Responds to GET requests.

Return value

\Drupal\rest\ResourceResponse The response containing the position data.

File

migrate_example_advanced/migrate_example_advanced_setup/src/Plugin/rest/resource/PositionResource.php, line 32
Contains \Drupal\migrate_example_advanced_setup\Plugin\rest\resource\PositionResource.

Class

PositionResource
Represents positions as resources.

Namespace

Drupal\migrate_example_advanced_setup\Plugin\rest\resource

Code

public function get() {
  $position1 = [
    'sourceid' => 'wine_taster',
    'name' => 'Wine Taster',
  ];
  $position2 = [
    'sourceid' => 'vintner',
    'name' => 'Vintner',
  ];
  $data = [
    'position' => [
      $position1,
      $position2,
    ],
  ];
  $response = new ResourceResponse($data, 200);
  return $response;
}