getRouteCollection() as $route) { $methods = $route->getMethods(); if (empty($methods)) { $route->setMethods(['GET', 'POST']); } } } /** * {@inheritdoc} */ public static function getSubscribedEvents() { // Set a higher priority to ensure that routes get the default HTTP methods // as early as possible. $events[RoutingEvents::ALTER][] = ['onRouteBuilding', 5000]; return $events; } }