当前位置: 首页>>代码示例>>PHP>>正文


PHP UrlGenerator::doGenerate方法代码示例

本文整理汇总了PHP中Symfony\Component\Routing\Generator\UrlGenerator::doGenerate方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlGenerator::doGenerate方法的具体用法?PHP UrlGenerator::doGenerate怎么用?PHP UrlGenerator::doGenerate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Routing\Generator\UrlGenerator的用法示例。


在下文中一共展示了UrlGenerator::doGenerate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doGenerate

 /**
  * {@override}
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute)
 {
     if (is_object($parameters)) {
         $parameters = $this->readObjectParameters($parameters, $variables);
     }
     return parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute);
 }
开发者ID:nmariani,项目名称:KnpRadBundle,代码行数:10,代码来源:UrlGenerator.php

示例2: doGenerate

 /**
  * @throws MissingMandatoryParametersException When route has some missing mandatory parameters
  * @throws InvalidParameterException When a parameter value is not correct
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
 {
     $baseUrl = $this->getContext()->getBaseUrl();
     if ($name[0] != '_' && ($locale = $this->getContext()->getParameter('_locale'))) {
         $this->getContext()->setBaseUrl($baseUrl . '/' . $locale);
     }
     $result = parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
     $this->getContext()->setBaseUrl($baseUrl);
     return $result;
 }
开发者ID:aminin,项目名称:symfony-workshop,代码行数:14,代码来源:LocalePrefixedUrlGenerator.php

示例3: doGenerate

 /**
  * {@inheritdoc}
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
 {
     $link = $name;
     if ($params = array_intersect_key($parameters, array_flip(isset($defaults['_variables']) ? $defaults['_variables'] : $variables))) {
         $link .= '?' . http_build_query($params);
         if ($properties = $this->getRouteProperties($link)) {
             list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = $properties;
         }
     }
     if ($referenceType === self::LINK_URL) {
         return $link;
     }
     return parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:17,代码来源:UrlGenerator.php

示例4: doGenerate

 /**
  * @param $variables
  * @param $defaults
  * @param $requirements
  * @param $tokens
  * @param $parameters
  * @param $name
  * @param $referenceType
  * @param $hostTokens
  * @param array $requiredSchemes
  * @return null|string
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
 {
     if (is_object($parameters)) {
         $object = $parameters;
         $parameters = [];
     } elseif (isset($parameters['object']) && is_object($parameters['object'])) {
         $object = $parameters['object'];
         unset($parameters['object']);
     }
     if (isset($object)) {
         $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters);
         $requiredParams = array_diff_key(array_flip($variables), $mergedParams);
         $parameters += $this->getParametersFromObject(array_keys($requiredParams), $object);
     }
     return BaseUrlGenerator::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
 }
开发者ID:piotrminkina,项目名称:routing-bundle,代码行数:28,代码来源:UrlGenerator.php

示例5: doGenerate

 /**
  * Surcharge de l'url generator pour générer une route en fonction d'un objet (paramètre _object)
  * Les paramètres passés directement à la route sont prioritaires par rapport aux champs de _object
  * {@inheritdoc}
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = [])
 {
     if (isset($defaults['_external']) && '' !== $this->context->getBaseUrl()) {
         $oldBaseUrl = $this->context->getBaseUrl();
         $this->context->setBaseUrl('');
     }
     if (isset($parameters['_object'])) {
         $object = $parameters['_object'];
         $parameters = array_merge($this->getParametersFromObject($variables, $object), $parameters);
         unset($parameters['_object']);
     }
     $url = parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
     if (isset($oldBaseUrl)) {
         $this->context->setBaseUrl($oldBaseUrl);
     }
     return $url;
 }
开发者ID:nuxia,项目名称:nuxia-plugin,代码行数:22,代码来源:UrlGenerator.php

示例6: doGenerate

 /**
  * @param       $variables
  * @param       $defaults
  * @param       $requirements
  * @param       $tokens
  * @param       $parameters
  * @param       $name
  * @param       $referenceType
  * @param       $hostTokens
  * @param array $requiredSchemes
  * @return string
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array())
 {
     if (array_key_exists(self::GENERATE_NORMAL_ROUTE, $parameters)) {
         unset($parameters[self::GENERATE_NORMAL_ROUTE]);
         return parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
     }
     //use the cached version with my name - do the standard request if its not work
     // dont generate assets
     if (stripos($name, RouteLoader::ROUTE_BEGIN) !== 0 && stripos($name, '_assetic') !== 0) {
         $routeNames = $this->generateRouteNames($name, $this->context->getParameters(), $defaults, $parameters, $variables, $requirements);
         foreach ($routeNames as $routeName) {
             try {
                 return $this->generate($routeName, $parameters, $referenceType);
             } catch (RouteNotFoundException $e) {
             }
         }
     }
     return parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
 }
开发者ID:vstm,项目名称:IbrowsSimpleSeoBundle,代码行数:31,代码来源:UrlGenerator.php

示例7: doGenerate

 /**
  * @inheritdoc
  */
 protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array())
 {
     $parameters = $this->removeUnusedAutoParameters($this->automaticParameters, $parameters, $variables);
     return parent::doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
 }
开发者ID:pmdc,项目名称:UnifikSystemBundle,代码行数:8,代码来源:RouterUrlGenerator.php


注:本文中的Symfony\Component\Routing\Generator\UrlGenerator::doGenerate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。