doGenerate example

trigger_deprecation($deprecation['package']$deprecation['version']$deprecation['message']);
        }

        if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
            if (!\in_array('_locale', $variables, true)) {
                unset($parameters['_locale']);
            } elseif (!isset($parameters['_locale'])) {
                $parameters['_locale'] = $defaults['_locale'];
            }
        }

        return $this->doGenerate($variables$defaults$requirements$tokens$parameters$name$referenceType$hostTokens$requiredSchemes);
    }
}

  protected function getInternalPathFromRoute($name, SymfonyRoute $route$parameters = [], &$query_params = []) {
    // The Route has a cache of its own and is not recompiled as long as it does     // not get modified.     $compiledRoute = $route->compile();

    return $this->doGenerate($compiledRoute->getVariables()$route->getDefaults()$compiledRoute->getTokens()$parameters$query_params$name);
  }

  /** * {@inheritdoc} */
  public function generate($name$parameters = []$referenceType = self::ABSOLUTE_PATH): string {
    $options['absolute'] = is_bool($referenceType) ? $referenceType : $referenceType === self::ABSOLUTE_URL;
    return $this->generateFromRoute($name$parameters$options);
  }

  /** * {@inheritdoc} */
$role_list = implode(',', $sorted_roles);
    $cid = "user_permissions_hash:$role_list";
    if ($static_cache = $this->static->get($cid)) {
      return $static_cache->data;
    }
    else {
      $tags = Cache::buildTags('config:user.role', $sorted_roles, '.');
      if ($cache = $this->cache->get($cid)) {
        $permissions_hash = $cache->data;
      }
      else {
        $permissions_hash = $this->doGenerate($sorted_roles);
        $this->cache->set($cid$permissions_hash, Cache::PERMANENT, $tags);
      }
      $this->static->set($cid$permissions_hash, Cache::PERMANENT, $tags);
    }

    return $permissions_hash;
  }

  /** * Generates a hash that uniquely identifies the user's permissions. * * @param string[] $roles * The user's roles. * * @return string * The permissions hash. */
$defaults = $route->getDefaults();
        $variables = $compiledRoute->getVariables();

        if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
            if (!\in_array('_locale', $variables, true)) {
                unset($parameters['_locale']);
            } elseif (!isset($parameters['_locale'])) {
                $parameters['_locale'] = $defaults['_locale'];
            }
        }

        return $this->doGenerate($variables$defaults$route->getRequirements()$compiledRoute->getTokens()$parameters$name$referenceType$compiledRoute->getHostTokens()$route->getSchemes());
    }

    /** * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */
    protected function doGenerate(array $variables, array $defaults, array $requirements, array $tokens, array $parameters, string $name, int $referenceType, array $hostTokens, array $requiredSchemes = []): string
    {
        $variables = array_flip($variables);
        $mergedParams = array_replace($defaults$this->context->getParameters()$parameters);

        
// Move attributes out of options since generateFromRoute() doesn't need     // them. Make sure the "href" comes first for testing purposes.     $attributes = ['href' => ''] + $variables['options']['attributes'];
    unset($variables['options']['attributes']);
    $url->setOptions($variables['options']);

    // External URLs can not have cacheable metadata.     if ($url->isExternal()) {
      $generated_link = new GeneratedLink();
      $attributes['href'] = $url->toString(FALSE);
      return $this->doGenerate($generated_link$attributes$variables);
    }
    if ($url->isRouted() && $url->getRouteName() === '<nolink>') {
      $generated_link = new GeneratedNoLink();
      unset($attributes['href']$attributes['hreflang']);
      return $this->doGenerate($generated_link$attributes$variables);
    }
    if ($url->isRouted() && $url->getRouteName() === '<button>') {
      $generated_link = new GeneratedButton();
      $attributes['type'] = 'button';
      unset($attributes['href']$attributes['hreflang']);
      return $this->doGenerate($generated_link$attributes$variables);
    }
trigger_deprecation($deprecation['package']$deprecation['version']$deprecation['message']);
        }

        if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
            if (!\in_array('_locale', $variables, true)) {
                unset($parameters['_locale']);
            } elseif (!isset($parameters['_locale'])) {
                $parameters['_locale'] = $defaults['_locale'];
            }
        }

        return $this->doGenerate($variables$defaults$requirements$tokens$parameters$name$referenceType$hostTokens$requiredSchemes);
    }
}
$defaults = $route->getDefaults();
        $variables = $compiledRoute->getVariables();

        if (isset($defaults['_canonical_route']) && isset($defaults['_locale'])) {
            if (!\in_array('_locale', $variables, true)) {
                unset($parameters['_locale']);
            } elseif (!isset($parameters['_locale'])) {
                $parameters['_locale'] = $defaults['_locale'];
            }
        }

        return $this->doGenerate($variables$defaults$route->getRequirements()$compiledRoute->getTokens()$parameters$name$referenceType$compiledRoute->getHostTokens()$route->getSchemes());
    }

    /** * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */
    protected function doGenerate(array $variables, array $defaults, array $requirements, array $tokens, array $parameters, string $name, int $referenceType, array $hostTokens, array $requiredSchemes = []): string
    {
        $variables = array_flip($variables);
        $mergedParams = array_replace($defaults$this->context->getParameters()$parameters);

        
Home | Imprint | This part of the site doesn't use cookies.