protected function DeveloperAppByNameRouteAlterSubscriber::alterRoutes in Apigee Edge 8
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- src/
Routing/ DeveloperAppByNameRouteAlterSubscriber.php, line 41
Class
- DeveloperAppByNameRouteAlterSubscriber
- Registers the 'type' of the 'app' route parameter if 'user' is available.
Namespace
Drupal\apigee_edge\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($collection as $id => $route) {
if (strpos($id, 'entity.developer_app') !== FALSE && in_array('user', $route
->compile()
->getPathVariables()) && in_array('app', $route
->compile()
->getPathVariables())) {
$params = $route
->getOption('parameters') ?? [];
NestedArray::setValue($params, [
'app',
'type',
], 'developer_app_by_name');
$route
->setOption('parameters', $params);
}
}
}