class NoSerializationClassTestResource

Same name and namespace in other branches
  1. 11.x core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php \Drupal\rest_test\Plugin\rest\resource\NoSerializationClassTestResource

Class used to test that serialization_class is optional.

Plugin annotation


@RestResource(
  id = "serialization_test",
  label = @Translation("Optional serialization_class"),
  serialization_class = "",
  uri_paths = {}
)

Hierarchy

Expanded class hierarchy of NoSerializationClassTestResource

File

core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php, line 18

Namespace

Drupal\rest_test\Plugin\rest\resource
View source
class NoSerializationClassTestResource extends ResourceBase {
  
  /**
   * Responds to a POST request.
   *
   * @param array $data
   *   An array with the payload.
   *
   * @return \Drupal\rest\ResourceResponse
   */
  public function post(array $data) {
    return new ResourceResponse($data);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.