You are here

private function DeveloperAppRouteProvider::ensureUserParameter in Apigee Edge 8

If route contains the {user} parameter add required changes to the route.

Parameters

\Symfony\Component\Routing\Route $route: The route to be checked and altered if needed.

10 calls to DeveloperAppRouteProvider::ensureUserParameter()
DeveloperAppRouteProvider::getAddApiKeyRoute in src/Entity/DeveloperAppRouteProvider.php
Gets the add-api-key-form route for a developer app.
DeveloperAppRouteProvider::getAddFormRouteForDeveloper in src/Entity/DeveloperAppRouteProvider.php
Gets the add-form route for developer.
DeveloperAppRouteProvider::getAnalyticsRouteForDeveloper in src/Entity/DeveloperAppRouteProvider.php
Gets the app analytics route for a developer.
DeveloperAppRouteProvider::getApiKeyRouteDeveloperApp in src/Entity/DeveloperAppRouteProvider.php
Gets the api key route for a developer app.
DeveloperAppRouteProvider::getCanonicalRouteByDeveloper in src/Entity/DeveloperAppRouteProvider.php
Gets the canonical route for a developer.

... See full list

File

src/Entity/DeveloperAppRouteProvider.php, line 313

Class

DeveloperAppRouteProvider
Default entity routes for developer apps.

Namespace

Drupal\apigee_edge\Entity

Code

private function ensureUserParameter(Route $route) {
  if (strpos($route
    ->getPath(), '{user}') !== FALSE) {

    // Default validation criteria based on Drupal core paths.
    $route
      ->setRequirement('user', '\\d+');

    // Make sure the parameter gets up-casted.
    // (This also ensures that we get an "Page not found" page if user with
    // uid does not exist.)
    $route
      ->setOption('parameters', [
      'user' => [
        'type' => 'entity:user',
        'converter' => 'paramconverter.entity',
      ],
    ]);
  }
}