You are here

public function AddComment::process in JSON:API Resources 8

Process the resource request.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

\Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel $document: The deserialized request document.

Return value

\Drupal\jsonapi\ResourceResponse The response.

Throws

\Symfony\Component\HttpKernel\Exception\ConflictHttpException Thrown when the entity to be created already exists.

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the storage handler couldn't be loaded.

\Drupal\Core\Entity\EntityStorageException Thrown if the entity could not be saved.

File

tests/modules/jsonapi_resources_test/src/Resource/AddComment.php, line 66

Class

AddComment
Processes a request to create a comment on an article.

Namespace

Drupal\jsonapi_resources_test\Resource

Code

public function process(Request $request, JsonApiDocumentTopLevel $document) : ResourceResponse {
  return $this
    ->processEntityCreation($request, $document);
}