class ResourceRoutes implements EventSubscriberInterface (View source)

Subscriber for REST-style routes.

Properties

protected ResourcePluginManager $manager

The plugin manager for REST plugins.

protected EntityStorageInterface $resourceConfigStorage

The REST resource config storage.

protected LoggerInterface $logger

A logger instance.

Methods

__construct(ResourcePluginManager $manager, EntityTypeManagerInterface $entity_type_manager, LoggerInterface $logger)

Constructs a RouteSubscriber object.

array
onDynamicRouteEvent(RouteBuildEvent $event)

Alters existing routes for a specific collection.

RouteCollection
getRoutesForResourceConfig(RestResourceConfigInterface $rest_resource_config)

Provides all routes for a given REST resource config.

static 
getSubscribedEvents()

{@inheritdoc}

Details

__construct(ResourcePluginManager $manager, EntityTypeManagerInterface $entity_type_manager, LoggerInterface $logger)

Constructs a RouteSubscriber object.

Parameters

ResourcePluginManager $manager

The resource plugin manager.

EntityTypeManagerInterface $entity_type_manager

The entity type manager

LoggerInterface $logger

A logger instance.

array onDynamicRouteEvent(RouteBuildEvent $event)

Alters existing routes for a specific collection.

Parameters

RouteBuildEvent $event

The route build event.

Return Value

array

protected RouteCollection getRoutesForResourceConfig(RestResourceConfigInterface $rest_resource_config)

Provides all routes for a given REST resource config.

This method determines where a resource is reachable, what path replacements are used, the required HTTP method for the operation etc.

Parameters

RestResourceConfigInterface $rest_resource_config

The rest resource config.

Return Value

RouteCollection

The route collection.

static getSubscribedEvents()

{@inheritdoc}