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


PHP Generator\UrlGeneratorInterface类代码示例

本文整理汇总了PHP中Symfony\Component\Routing\Generator\UrlGeneratorInterface的典型用法代码示例。如果您正苦于以下问题:PHP UrlGeneratorInterface类的具体用法?PHP UrlGeneratorInterface怎么用?PHP UrlGeneratorInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

 function its_on_registration_success(FormEvent $event, UrlGeneratorInterface $router, RandomUsernameGenerator $generator)
 {
     $router->generate('quickstart_app_account')->shouldBeCalled()->willReturn('/en/account');
     $this->beConstructedWith($router, $generator);
     $event->setResponse(Argument::type('Symfony\\Component\\HttpFoundation\\RedirectResponse'))->shouldBeCalled();
     $this->onRegistrationSuccess($event);
 }
开发者ID:mseshachalam,项目名称:quick-up,代码行数:7,代码来源:RegistrationListenerSpec.php

示例2: getUrl

 /**
  * Returns the canonical url for the current request,
  * or null if called outside of the request cycle.
  *
  * @return string|null
  */
 public function getUrl()
 {
     if (($request = $this->requestStack->getCurrentRequest()) === null) {
         return null;
     }
     return $this->urlGenerator->generate($request->attributes->get('_route'), $request->attributes->get('_route_params'), UrlGeneratorInterface::ABSOLUTE_URL);
 }
开发者ID:bolt,项目名称:bolt,代码行数:13,代码来源:Canonical.php

示例3: guessValues

 /**
  * {@inheritdoc}.
  */
 public function guessValues(UrlInformation $urlInformation, $object, $sitemap)
 {
     if ($urlInformation->getLocation()) {
         return;
     }
     $urlInformation->setLocation($this->urlGenerator->generate($object, array(), UrlGeneratorInterface::ABSOLUTE_URL));
 }
开发者ID:symfony-cmf,项目名称:seo-bundle,代码行数:10,代码来源:LocationGuesser.php

示例4: apply

 /**
  * {@inheritdoc}
  */
 public function apply(array &$options, ItemInterface $item)
 {
     if (!empty($options['route'])) {
         $route = (array) $options['route'] + array('', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
         $options['uri'] = $this->generator->generate($route[0], $route[1], $route[2]);
     }
 }
开发者ID:rybakit,项目名称:RybakitNavigationBundle,代码行数:10,代码来源:UrlFilter.php

示例5: generateUrl

 /**
  * @param string $route
  * @param array $parameters
  * @param string $referenceType
  * @return string
  * @throws MissingDependencyException
  */
 public function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
 {
     if (null === $this->urlGenerator) {
         throw new MissingDependencyException('No router present.');
     }
     return $this->urlGenerator->generate($route, $parameters, $referenceType);
 }
开发者ID:seiffert,项目名称:controller-helper-bundle,代码行数:14,代码来源:RouterHelper.php

示例6: mapPath

 /**
  * {@inheritdoc}
  */
 public function mapPath($path, $build, $development)
 {
     if (substr($path, 0, 1) === '/') {
         return $path;
     }
     return $this->urlGenerator->generate('tq_extjs_application_resources', ['build' => $build, 'dev' => $development ? '-dev' : '', 'path' => str_replace('..', '~', $path)]);
 }
开发者ID:teqneers,项目名称:ext-application-bundle,代码行数:10,代码来源:UrlPathMapper.php

示例7: getAuthorizationUrl

 /**
  * {@inheritDoc}
  */
 public function getAuthorizationUrl($redirectUrl)
 {
     if (!preg_match('#^https://.*#', $redirectUrl)) {
         $redirectUrl = $this->generator->generate($redirectUrl, array(), true);
     }
     return parent::getAuthorizationUrl($redirectUrl);
 }
开发者ID:pminnieur,项目名称:alterego,代码行数:10,代码来源:Authorization.php

示例8: addItem

 /**
  * Add new breadcrumb item
  * @param string $linkName
  * @param string|array|null $target
  * @return void
  */
 public function addItem($linkName, $target = null)
 {
     if (is_array($target)) {
         $target = isset($target['params']) ? $this->urlGen->generate($target['route'], $target['params']) : $this->urlGen->generate($target['route']);
     }
     $this->items[] = array("linkName" => $linkName, "target" => $target);
 }
开发者ID:nymo,项目名称:silex-twig-breadcrumb-extension,代码行数:13,代码来源:BreadCrumbCollection.php

示例9: addFreePaymentPaymentMethod

 /**
  * Add Free payment method
  *
  * @param PaymentCollectionEvent $event Event
  */
 public function addFreePaymentPaymentMethod(PaymentCollectionEvent $event)
 {
     if ($this->plugin->isUsable()) {
         $bankwire = new PaymentMethod($this->plugin->getHash(), 'elcodi_plugin.bankwire.name', 'elcodi_plugin.bankwire.description', $this->router->generate('paymentsuite_bankwire_execute'));
         $event->addPaymentMethod($bankwire);
     }
 }
开发者ID:pramoddas,项目名称:bamboo,代码行数:12,代码来源:PaymentCollectEventListener.php

示例10: createAction

 /**
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function createAction($content, Request $request)
 {
     $this->forward400Unless('json' == $request->getContentType() || 'form' == $request->getContentType());
     $rawPayment = ArrayObject::ensureArrayObject($content);
     $form = $this->formFactory->create('create_payment');
     $form->submit((array) $rawPayment);
     if (false == $form->isValid()) {
         return new JsonResponse($this->formToJsonConverter->convertInvalid($form), 400);
     }
     /** @var Payment $payment */
     $payment = $form->getData();
     $payment->setId(Random::generateToken());
     $storage = $this->payum->getStorage($payment);
     $storage->update($payment);
     $payment->setNumber($payment->getNumber() ?: date('Ymd-' . mt_rand(10000, 99999)));
     $storage->update($payment);
     // TODO
     $payment->setValue('links', 'done', 'http://dev.payum-server.com/client/index.html');
     $payment->setValue('links', 'self', $this->urlGenerator->generate('payment_get', ['id' => $payment->getId()], true));
     $token = $this->payum->getTokenFactory()->createAuthorizeToken($payment->getGatewayName(), $payment, $payment->getValue('links', 'done'), ['payum_token' => null, 'payment' => $payment->getId()]);
     $payment->setValue('links', 'authorize', $token->getTargetUrl());
     $token = $this->payum->getTokenFactory()->createCaptureToken($payment->getGatewayName(), $payment, $payment->getValue('links', 'done'), ['payum_token' => null, 'payment' => $payment->getId()]);
     $payment->setValue('links', 'capture', $token->getTargetUrl());
     $token = $this->payum->getTokenFactory()->createNotifyToken($payment->getGatewayName(), $payment);
     $payment->setValue('links', 'notify', $token->getTargetUrl());
     $storage->update($payment);
     return new JsonResponse(array('payment' => $this->paymentToJsonConverter->convert($payment)), 201, array('Location' => $payment->getValue('links', 'self')));
 }
开发者ID:Zifius,项目名称:PayumServer,代码行数:33,代码来源:PaymentController.php

示例11: render

 /**
  * {@inheritdoc}
  */
 public function render(GridViewInterface $grid, ColumnInterface $column, $sorting)
 {
     $definition = $grid->getDefinition();
     $name = $column->getName();
     if (!$definition->hasSort($name)) {
         return;
     }
     $sort = $sorting === SorterInterface::ASC ? $name : '-' . $name;
     $routeParameters = [];
     if (($request = $this->requestStack->getMasterRequest()) !== null) {
         $routeParameters = array_merge($request->attributes->get('_route_params', []), $request->query->all());
     }
     if (!isset($routeParameters['grid']['reset']) && isset($routeParameters['grid']['sorting']) && $routeParameters['grid']['sorting'] === $sort) {
         return;
     }
     if ($definition->hasOption('persistent') && $definition->getOption('persistent')) {
         $filters = $this->filterManager->get($definition);
         if (isset($filters['sorting']) && $filters['sorting'] === $sort) {
             return;
         }
     }
     $routeParameters['grid']['sorting'] = $sort;
     unset($routeParameters['grid']['reset']);
     return $this->urlGenerator->generate($definition->getOption('grid_route'), $routeParameters);
 }
开发者ID:php-lug,项目名称:lug,代码行数:28,代码来源:SorterRenderer.php

示例12: generateControllerRoute

 /**
  * Generates referral program tracking route
  *
  * @param ReferralHashInterface $referralHash Referral hash
  *
  * @return string
  */
 public function generateControllerRoute(ReferralHashInterface $referralHash)
 {
     /**
      * Referral link generation
      */
     return $this->routeGenerator->generate($this->controllerRouteName, array('hash' => $referralHash->getHash()), true);
 }
开发者ID:hd-deman,项目名称:elcodi,代码行数:14,代码来源:ReferralRouteManager.php

示例13: addPaypalPaymentMethod

 /**
  * Add PayPal payment method
  *
  * @param PaymentCollectionEvent $event Event
  */
 public function addPaypalPaymentMethod(PaymentCollectionEvent $event)
 {
     if ($this->plugin->isUsable(['business'])) {
         $paypal = new PaymentMethod($this->plugin->getHash(), 'elcodi_plugin.paypal_web_checkout.name', 'elcodi_plugin.paypal_web_checkout.description', $this->router->generate('paymentsuite_paypal_web_checkout_execute'));
         $event->addPaymentMethod($paypal);
     }
 }
开发者ID:elcodi,项目名称:bamboo,代码行数:12,代码来源:PaymentCollectEventListener.php

示例14: buildForm

 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setAction($this->urlGenerator->generate($options['route'], $options['route_parameters']));
     $builder->setMethod('POST');
     $builder->add('locale', 'choice', ['label' => false, 'required' => true, 'widget_addon_prepend' => ['icon' => 'language'], 'choices' => $this->localeChoiceList->create(), 'choices_as_values' => true]);
     $builder->add('switch', 'submit', ['label' => 'stepup_middleware_client.form.switch_locale.switch', 'attr' => ['class' => 'btn btn-default']]);
 }
开发者ID:surfnet,项目名称:stepup-bundle,代码行数:7,代码来源:SwitchLocaleType.php

示例15: failureAction

 /**
  * Payment fail action.
  *
  * @param Request $request Request element
  *
  * @return Response
  */
 public function failureAction(Request $request)
 {
     $orderId = $request->query->get('order_id', false);
     $failureRoute = $this->redirectionRoutes->getRedirectionRoute('failure');
     $redirectUrl = $this->urlGenerator->generate($failureRoute->getRoute(), $failureRoute->getRouteAttributes($orderId));
     return new RedirectResponse($redirectUrl);
 }
开发者ID:xsbaltran,项目名称:RedsysBundle,代码行数:14,代码来源:ResponseController.php


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