interface RouteMatchInterface (View source)

Provides an interface for classes representing the result of routing.

Routing is the process of selecting the best matching candidate from a collection of routes for an incoming request. The relevant properties of a request include the path as well as a list of raw parameter values derived from the URL. If an appropriate route is found, raw parameter values will be upcast automatically if possible.

The route match object contains useful information about the selected route as well as the raw and upcast parameters derived from the incoming request.

Methods

string|null
getRouteName()

Returns the route name.

Route|null
getRouteObject()

Returns the route object.

mixed|null
getParameter(string $parameter_name)

Returns the processed value of a named route parameter.

ParameterBag
getParameters()

Returns the bag of all processed route parameters.

string|null
getRawParameter(string $parameter_name)

Returns the raw value of a named route parameter.

ParameterBag
getRawParameters()

Returns the bag of all raw route parameters.

Details

string|null getRouteName()

Returns the route name.

Return Value

string|null

The route name. NULL if no route is matched.

Route|null getRouteObject()

Returns the route object.

Return Value

Route|null

The route object. NULL if no route is matched.

mixed|null getParameter(string $parameter_name)

Returns the processed value of a named route parameter.

Raw URL parameters are processed by the parameter conversion system, which does operations such as converting entity ID parameters to fully-loaded entities. For example, the path node/12345 would have a raw node ID parameter value of 12345, while the processed parameter value would be the corresponding loaded node object.

Parameters

string $parameter_name

The parameter name.

Return Value

mixed|null

The parameter value. NULL if the route doesn't define the parameter or if the parameter value can't be determined from the request.

See also

RouteMatchInterface::getRawParameter

ParameterBag getParameters()

Returns the bag of all processed route parameters.

Raw URL parameters are processed by the parameter conversion system, which does operations such as converting entity ID parameters to fully-loaded entities. For example, the path node/12345 would have a raw node ID parameter value of 12345, while the processed parameter value would be the corresponding loaded node object.

Return Value

ParameterBag

The parameter bag.

See also

RouteMatchInterface::getRawParameters

string|null getRawParameter(string $parameter_name)

Returns the raw value of a named route parameter.

Parameters

string $parameter_name

The parameter name.

Return Value

string|null

The raw (non-upcast) parameter value. NULL if the route doesn't define the parameter or if the raw parameter value can't be determined from the request.

See also

RouteMatchInterface::getParameter

ParameterBag getRawParameters()

Returns the bag of all raw route parameters.

Return Value

ParameterBag

The parameter bag.

See also

RouteMatchInterface::getParameters