class RouteMethodSubscriber implements EventSubscriberInterface (View source)

Provides a default value for the HTTP method restriction on routes.

Most routes will only deal with GET and POST requests, so we restrict them to those two if nothing else is specified. This is necessary to give other routes a chance during the route matching process when they are listening for example to DELETE requests on the same path. A typical use case are REST web service routes that use the full spectrum of HTTP methods.

Methods

onRouteBuilding(RouteBuildEvent $event)

Sets a default value of GET|POST for the _method route property.

static 
getSubscribedEvents()

{@inheritdoc}

Details

onRouteBuilding(RouteBuildEvent $event)

Sets a default value of GET|POST for the _method route property.

Parameters

RouteBuildEvent $event

The event containing the build routes.

static getSubscribedEvents()

{@inheritdoc}