You are here

function rest_post_update_create_rest_resource_config_entities in Drupal 8

Create REST resource configuration entities.

See also

rest_update_8201()

https://www.drupal.org/node/2308745

File

core/modules/rest/rest.post_update.php, line 17
Post update functions for Rest.

Code

function rest_post_update_create_rest_resource_config_entities() {
  $resources = \Drupal::state()
    ->get('rest_update_8201_resources', []);
  foreach ($resources as $key => $resource) {
    $resource = RestResourceConfig::create([
      'id' => str_replace(':', '.', $key),
      'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY,
      'configuration' => $resource,
    ]);
    $resource
      ->save();
  }
}