class ParamConversionEnhancer implements EnhancerInterface, EventSubscriberInterface (View source)

Provides a route enhancer that handles parameter conversion.

Properties

protected ParamConverterManagerInterface $paramConverterManager

The parameter conversion manager.

Methods

__construct(ParamConverterManagerInterface $param_converter_manager)

Constructs a new ParamConversionEnhancer.

array
enhance(array $defaults, Request $request)

Updates the defaults for a route definition based on the request.

ParameterBag
copyRawVariables(array $defaults)

Store a backup of the raw values that corresponding to the route pattern.

onException(ExceptionEvent $event)

Catches failed parameter conversions and throw a 404 instead.

static 
getSubscribedEvents()

{@inheritdoc}

Details

__construct(ParamConverterManagerInterface $param_converter_manager)

Constructs a new ParamConversionEnhancer.

Parameters

ParamConverterManagerInterface $param_converter_manager

The parameter conversion manager.

array enhance(array $defaults, Request $request)

Updates the defaults for a route definition based on the request.

Parameters

array $defaults

The defaults, maps to '_defaults' in the route definition YAML.

Request $request

The Request instance.

Return Value

array

The modified defaults. Each enhancer MUST return the $defaults but may add or remove values.

protected ParameterBag copyRawVariables(array $defaults)

Store a backup of the raw values that corresponding to the route pattern.

Parameters

array $defaults

The route defaults array.

Return Value

ParameterBag

onException(ExceptionEvent $event)

Catches failed parameter conversions and throw a 404 instead.

Parameters

ExceptionEvent $event

The event.

static getSubscribedEvents()

{@inheritdoc}