NoSerializationClassTestResource.php

Same filename in other branches
  1. 9 core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php
  2. 10 core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php
  3. 11.x core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php

Namespace

Drupal\rest_test\Plugin\rest\resource

File

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

View source
<?php

namespace Drupal\rest_test\Plugin\rest\resource;

use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;

/**
 * Class used to test that serialization_class is optional.
 *
 * @RestResource(
 *   id = "serialization_test",
 *   label = @Translation("Optional serialization_class"),
 *   serialization_class = "",
 *   uri_paths = {}
 * )
 */
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);
    }

}

Classes

Title Deprecated Summary
NoSerializationClassTestResource Class used to test that serialization_class is optional.

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