function ParamConverterManager::setRouteParameterConverters
Saves a list of applicable converters to each route.
Parameters
\Symfony\Component\Routing\RouteCollection $routes: A collection of routes to apply converters to.
Overrides ParamConverterManagerInterface::setRouteParameterConverters
File
- 
              core/
lib/ Drupal/ Core/ ParamConverter/ ParamConverterManager.php, line 46  
Class
- ParamConverterManager
 - Manages converter services for converting request parameters to full objects.
 
Namespace
Drupal\Core\ParamConverterCode
public function setRouteParameterConverters(RouteCollection $routes) {
  foreach ($routes->all() as $route) {
    if (!$parameters = $route->getOption('parameters')) {
      // Continue with the next route if no parameters have been defined.
      continue;
    }
    // Loop over all defined parameters and look up the right converter.
    foreach ($parameters as $name => &$definition) {
      if (isset($definition['converter'])) {
        // Skip parameters that already have a manually set converter.
        continue;
      }
      foreach (array_keys($this->converters) as $converter) {
        if ($this->getConverter($converter)
          ->applies($definition, $name, $route)) {
          $definition['converter'] = $converter;
          break;
        }
      }
    }
    // Override the parameters array.
    $route->setOption('parameters', $parameters);
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.