function RestResourceGetRouteProcessorBC::processOutbound

Overrides OutboundRouteProcessorInterface::processOutbound

File

core/modules/rest/src/RouteProcessor/RestResourceGetRouteProcessorBC.php, line 45

Class

RestResourceGetRouteProcessorBC
Processes the BC REST routes, to ensure old route names continue to work.

Namespace

Drupal\rest\RouteProcessor

Code

public function processOutbound($route_name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
    $route_name_parts = explode('.', $route_name);
    // BC: the REST module originally created per-format GET routes, instead
    // of a single route. To minimize the surface of this BC layer, this uses
    // route definitions that are as empty as possible, plus an outbound route
    // processor.
    // @see \Drupal\rest\Plugin\ResourceBase::routes()
    if ($route_name_parts[0] === 'rest' && $route_name_parts[count($route_name_parts) - 2] === 'GET' && in_array($route_name_parts[count($route_name_parts) - 1], $this->serializerFormats, TRUE)) {
        array_pop($route_name_parts);
        $redirected_route_name = implode('.', $route_name_parts);
        @trigger_error(sprintf("The '%s' route is deprecated since version 8.5.x and will be removed in 9.0.0. Use the '%s' route instead.", $route_name, $redirected_route_name), E_USER_DEPRECATED);
        static::overwriteRoute($route, $this->routeProvider
            ->getRouteByName($redirected_route_name));
    }
}

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