class EntityAccessDeniedHttpExceptionNormalizer extends HttpExceptionNormalizer (View source)

internal  JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it.
 

Normalizes an EntityAccessDeniedException.

Normalizes an EntityAccessDeniedException in compliance with the JSON:API specification. A source pointer is added to help client applications report which entity was access denied.

Traits

SerializerAwareTrait

Properties

protected $supportedInterfaceOrClass {@inheritdoc}
protected $format {@inheritdoc} from  NormalizerBase
protected AccountInterface $currentUser

The current user making the request.

from  HttpExceptionNormalizer

Methods

supportsNormalization($data, $format = NULL)

{@inheritdoc}

supportsDenormalization($data, $type, $format = NULL)

Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()

bool
checkFormat(string $format = NULL)

Checks if the provided format is supported by this normalizer.

addCacheableDependency(array $context, $data)

Adds cacheability if applicable.

static mixed
rasterizeValueRecursive(mixed $value)

Rasterizes a value recursively.

__construct(AccountInterface $current_user)

HttpExceptionNormalizer constructor.

normalize($object, $format = NULL, array $context = [])

{@inheritdoc}

array
buildErrorObjects(HttpException $exception)

Builds the normalized JSON:API error objects for the response.

static string|null
getInfoUrl($status_code)

Return a string to the common problem type.

Details

supportsNormalization($data, $format = NULL)

{@inheritdoc}

Parameters

$data
$format

supportsDenormalization($data, $type, $format = NULL)

Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()

This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.

Parameters

$data
$type
$format

protected bool checkFormat(string $format = NULL)

Checks if the provided format is supported by this normalizer.

Parameters

string $format

The format to check.

Return Value

bool

TRUE if the format is supported, FALSE otherwise. If no format is specified this will return TRUE.

protected addCacheableDependency(array $context, $data)

Adds cacheability if applicable.

Parameters

array $context

Context options for the normalizer.

$data

The data that might have cacheability information.

bool hasCacheableSupportsMethod()

{@inheritdoc}

Return Value

bool

static protected mixed rasterizeValueRecursive(mixed $value)

Rasterizes a value recursively.

This is mainly for configuration entities where a field can be a tree of values to rasterize.

Parameters

mixed $value

Either a scalar, an array or a rasterizable object.

Return Value

mixed

The rasterized value.

__construct(AccountInterface $current_user)

HttpExceptionNormalizer constructor.

Parameters

AccountInterface $current_user

The current user.

normalize($object, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$object
$format
array $context

protected array buildErrorObjects(HttpException $exception)

Builds the normalized JSON:API error objects for the response.

Parameters

HttpException $exception

The Exception.

Return Value

array

The error objects to include in the response.

static string|null getInfoUrl($status_code)

internal  
 

Return a string to the common problem type.

Parameters

$status_code

Return Value

string|null

URL pointing to the specific RFC-2616 section. Or NULL if it is an HTTP status code that is defined in another RFC.

See also

https://www.drupal.org/project/drupal/issues/2832211#comment-11826234