本文整理汇总了PHP中Symfony\Component\Routing\Generator\UrlGeneratorInterface::setContext方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlGeneratorInterface::setContext方法的具体用法?PHP UrlGeneratorInterface::setContext怎么用?PHP UrlGeneratorInterface::setContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Routing\Generator\UrlGeneratorInterface
的用法示例。
在下文中一共展示了UrlGeneratorInterface::setContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareRouterContext
/**
* Prepares the Host part of a image resize URL
*
* @return mixed Route reference type
*/
private function prepareRouterContext()
{
if ($this->generatedRouteHost) {
$this->router->setContext($this->modifiedContext);
/**
* When a Host is set for the image route,
* we need to change the route context URL
*/
$this->router->getContext()->setHost($this->generatedRouteHost);
}
}
示例2: getGenerator
/**
* @return UrlGeneratorInterface
*/
public function getGenerator()
{
$this->generator->setContext($this->getContext());
return $this->generator;
}
示例3: setContext
/**
* {@inheritdoc}
*/
public function setContext(RequestContext $context)
{
$this->wrapped->setContext($context);
}
示例4: testRequestContext
/**
* @depends testUrlGeneratorInterface
*
* @param UrlGeneratorInterface $generator
*/
public function testRequestContext($generator)
{
$generator->setContext(new RequestContext('/bolt'));
$this->assertSame('/bolt', $generator->getContext()->getBaseUrl());
}
示例5: setContext
/**
* {@inheritdoc}
*/
public function setContext(RequestContext $context)
{
$this->router->setContext($context);
}