NoSerializationClassTestResource.php

Same filename in other branches
  1. 9 core/modules/rest/tests/modules/rest_test/src/Plugin/rest/resource/NoSerializationClassTestResource.php
  2. 8.9.x 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\Core\StringTranslation\TranslatableMarkup;
use Drupal\rest\Attribute\RestResource;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;

/**
 * Class used to test that serialization_class is optional.
 */
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.