You are here

final class DeveloperAppByNameRouteAlterSubscriber in Apigee Edge 8

Registers the 'type' of the 'app' route parameter if 'user' is available.

The {developer_app} parameter can be automatically resolved by EntityResolverManager, but in that case the value of in the path is the app id (UUID) and not the name of an app.

Hierarchy

Expanded class hierarchy of DeveloperAppByNameRouteAlterSubscriber

See also

\Drupal\apigee_edge\Entity\DeveloperApp::urlRouteParameters()

\Drupal\apigee_edge\ParamConverter\DeveloperAppNameConverter

1 string reference to 'DeveloperAppByNameRouteAlterSubscriber'
apigee_edge.services.yml in ./apigee_edge.services.yml
apigee_edge.services.yml
1 service uses DeveloperAppByNameRouteAlterSubscriber
route_subscriber.apigee_edge.developer_app_by_name in ./apigee_edge.services.yml
Drupal\apigee_edge\Routing\DeveloperAppByNameRouteAlterSubscriber

File

src/Routing/DeveloperAppByNameRouteAlterSubscriber.php, line 36

Namespace

Drupal\apigee_edge\Routing
View source
final class DeveloperAppByNameRouteAlterSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  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);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeveloperAppByNameRouteAlterSubscriber::alterRoutes protected function Alters existing routes for a specific collection. Overrides RouteSubscriberBase::alterRoutes
RouteSubscriberBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to. 5
RouteSubscriberBase::onAlterRoutes public function Delegates the route altering to self::alterRoutes(). 1