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


PHP Router::getGenerator方法代码示例

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


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

示例1: __construct

 /**
  * @param RouterInterface $router
  */
 public function __construct(Router $router)
 {
     /**
      * @var UrlGenerator $urlGenerator
      */
     $urlGenerator = $router->getGenerator();
     $this->urlGenerator = $urlGenerator;
 }
开发者ID:cleentfaar,项目名称:simplr-core,代码行数:11,代码来源:ExceptionListener.php

示例2: __construct

 public function __construct(Logger $logger, Messenger $messenger, Generator $generator, Memory $memory, Router $router, DocumentManager $objectManager)
 {
     $this->logger = $logger;
     $this->messenger = $messenger;
     $this->gameGenerator = $generator;
     $this->memory = $memory;
     $this->urlGenerator = $router->getGenerator();
     $this->objectManager = $objectManager;
 }
开发者ID:hafeez3000,项目名称:lichess,代码行数:9,代码来源:Rematcher.php

示例3: createPageFromRoute

 /**
  * Creates a Node object based on given $routeName or current route.
  *
  * @param string|null $routeName
  *
  * @return Node
  */
 public function createPageFromRoute($routeName = null)
 {
     if (!$routeName) {
         $routeName = $this->pageStack->getRequest()->attributes->get('_route');
         if (!$routeName) {
             throw new \RuntimeException('Could not detect route name');
         }
     }
     $reflection = new \ReflectionClass($this->router->getGenerator());
     $key = 'jarves_routes';
     $cache = $this->cacher->getFastCache($key);
     $validCache = false;
     $routes = [];
     if ($cache) {
         $validCache = $cache['time'] === filemtime($reflection->getFileName()) && isset($cache['routes']) && is_string($cache['routes']);
         if ($validCache) {
             $routes = unserialize($cache['routes']);
         }
     }
     if (!$validCache) {
         $routes = $this->router->getRouteCollection()->all();
         $this->cacher->setFastCache($key, ['time' => filemtime($reflection->getFileName()), 'routes' => serialize($routes)]);
     }
     if (!isset($routes[$routeName])) {
         throw new \RuntimeException("Route with name `{$routeName}` does not exist");
     }
     $route = $routes[$routeName];
     $url = $this->router->generate($routeName, $this->pageStack->getRequest()->attributes->all());
     $page = Node::createPage($route->getOption('title'), parse_url($url)['path'], $route->getOption('theme'), $route->getOption('layout'));
     if ($route->getOption('meta')) {
         foreach ((array) $route->getOption('meta') as $key => $value) {
             $page->meta->set($key, $value);
         }
     }
     return $page;
 }
开发者ID:jarves,项目名称:jarves,代码行数:43,代码来源:PageResponseFactory.php

示例4: __construct

 public function __construct(LoggerInterface $logger, Router $router)
 {
     $this->logger = $logger;
     $this->generator = $router->getGenerator();
 }
开发者ID:hotfics,项目名称:lichess-old,代码行数:5,代码来源:Logger.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param Router $router A Router instance
  */
 public function __construct(Router $router)
 {
     $this->generator = $router->getGenerator();
 }
开发者ID:skoop,项目名称:symfony-sandbox,代码行数:9,代码来源:RouterHelper.php

示例6: getGenerator

 public function getGenerator()
 {
     return new UrlGeneratorDecorator(parent::getGenerator(), $this->getContext());
 }
开发者ID:elfet,项目名称:silicone,代码行数:4,代码来源:Router.php

示例7: __construct

 /**
  * Constructor
  *
  * @param Router $router
  * @param string[][] $serializationData
  */
 public function __construct(Router $router, array $serializationData)
 {
     $this->urlGenerator = $router->getGenerator();
     $this->data = $serializationData;
 }
开发者ID:thesoftwarefactoryuk,项目名称:SenNetwork,代码行数:11,代码来源:ResourceLinkSerializationListener.php

示例8: buildDepositReceiptUrl

 /**
  * Build the URL for the deposit receipt.
  *
  * @param Deposit $deposit
  *
  * @return string
  */
 public function buildDepositReceiptUrl(Deposit $deposit)
 {
     return $this->router->getGenerator()->generate('statement', array('journal_uuid' => $deposit->getJournal()->getUuid(), 'deposit_uuid' => $deposit->getDepositUuid()), UrlGeneratorInterface::ABSOLUTE_URL);
 }
开发者ID:ubermichael,项目名称:pkppln-php,代码行数:11,代码来源:DepositBuilder.php

示例9: warmUp

 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $this->router->getMatcher();
     $this->router->getGenerator();
 }
开发者ID:gnugat,项目名称:micro-framework-bundle,代码行数:8,代码来源:RouterCacheWarmer.php

示例10: __construct

 public function __construct(Router $router, $nbPostsPerPage)
 {
     $this->generator = $router->getGenerator();
     $this->nbPostsPerPage = $nbPostsPerPage;
 }
开发者ID:hex337,项目名称:ForumBundle,代码行数:5,代码来源:ForumUrlGenerator.php

示例11: __construct

 public function __construct(Router $router, Request $request)
 {
     $this->router = $router;
     $this->request = $request;
     $this->generator = $router->getGenerator();
 }
开发者ID:jmarceli,项目名称:WellCommerce,代码行数:6,代码来源:RoutingExtension.php

示例12: __construct

 public function __construct(PlayerBlamer $playerBlamer, Router $router, Logger $logger)
 {
     $this->playerBlamer = $playerBlamer;
     $this->urlGenerator = $router->getGenerator();
     $this->logger = $logger;
 }
开发者ID:hafeez3000,项目名称:lichess,代码行数:6,代码来源:Joiner.php


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