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


PHP Service::getGenerator方法代码示例

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


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

示例1: editAction

 public function editAction(Player $me, Team $team)
 {
     $response = $this->edit($team, $me, "team");
     if ($this->newLeader) {
         // Redirect to a confirmation form if we are assigning a new leader
         $url = Service::getGenerator()->generate('team_assign_leader', array('team' => $team->getAlias(), 'player' => $this->newLeader->getAlias()));
         return new RedirectResponse($url);
     }
     return $response;
 }
开发者ID:kleitz,项目名称:bzion,代码行数:10,代码来源:TeamController.php

示例2: editAction

 public function editAction(Player $me, Match $match)
 {
     // TODO: Generating this response is unnecessary
     $response = $this->edit($match, $me, "match");
     if ($this->recalculateNeeded && $match->isOfficial()) {
         // Redirect to a confirmation form if we are assigning a new leader
         $url = Service::getGenerator()->generate('match_recalculate', array('match' => $match->getId()));
         return new RedirectResponse($url);
     }
     return $response;
 }
开发者ID:allejo,项目名称:bzion,代码行数:11,代码来源:MatchController.php

示例3: loginAction

 public function loginAction(Request $request, Player $me)
 {
     if ($me->isValid()) {
         throw new ForbiddenException("You are already logged in!");
     }
     $query = $request->query;
     $session = $request->getSession();
     $token = $query->get("token");
     $username = $query->get("username");
     if (!$token || !$username) {
         throw new BadRequestException();
     }
     // Don't check whether IPs match if we're on a development environment
     $checkIP = !$this->isDebug();
     $info = validate_token($token, $username, array(), $checkIP);
     if (!isset($info)) {
         throw new ForbiddenException("There was an error processing your login. Please go back and try again.");
     }
     $session->set("username", $info['username']);
     $session->set("groups", $info['groups']);
     $redirectToProfile = false;
     if (!Player::playerBZIDExists($info['bzid'])) {
         // If they're new, redirect to their profile page so they can add some info
         $player = Player::newPlayer($info['bzid'], $info['username']);
         $redirectToProfile = true;
     } else {
         $player = Player::getFromBZID($info['bzid']);
         if ($player->isDeleted()) {
             $player->setStatus('active');
         }
     }
     $session->set("playerId", $player->getId());
     $player->updateLastLogin();
     $player->setUsername($info['username']);
     Visit::enterVisit($player->getId(), $request->getClientIp(), gethostbyaddr($request->getClientIp()), $request->server->get('HTTP_USER_AGENT'), $request->server->get('HTTP_REFERER'));
     $this->configPromoteAdmin($player);
     if ($redirectToProfile) {
         $profile = Service::getGenerator()->generate('profile_show');
         return new RedirectResponse($profile);
     } else {
         return $this->goBack();
     }
 }
开发者ID:blast007,项目名称:bzion,代码行数:43,代码来源:LoginController.php

示例4: generate

 /**
  * Generates a URL from the given parameters.
  * @param  string  $name       The name of the route
  * @param  mixed   $parameters An array of parameters
  * @param  boolean $absolute   Whether to generate an absolute URL
  * @return string  The generated URL
  */
 public static function generate($name, $parameters = array(), $absolute = false)
 {
     return Service::getGenerator()->generate($name, $parameters, $absolute);
 }
开发者ID:bchhun,项目名称:bzion,代码行数:11,代码来源:Controller.php

示例5: build

 /**
  * {@inheritdoc}
  */
 protected function build($builder)
 {
     $notBlank = array('constraints' => new NotBlank());
     return $builder->add('Recipients', new AdvancedModelType(array('player', 'team')), array('constraints' => new Count(array('min' => 2, 'minMessage' => 'You need to specify the recipients of your message')), 'multiple' => true, 'include' => $this->editing))->add('Subject', 'text', $notBlank)->add('Message', 'textarea', $notBlank)->add('Send', 'submit')->setAction(\Service::getGenerator()->generate('message_compose'));
 }
开发者ID:blast007,项目名称:bzion,代码行数:8,代码来源:ConversationFormCreator.php

示例6: getLink

 /**
  * Generate a link for a route related to this object
  *
  * @param mixed   $identifier A parameter representing the model (e.g an ID or alias)
  * @param string  $action     The action to perform
  * @param bool $absolute   Whether to return an absolute URL
  * @param array   $params     Extra parameters to pass to the URL generator
  *
  * @return string A link
  */
 protected function getLink($identifier, $action, $absolute, $params)
 {
     return Service::getGenerator()->generate(static::getRouteName($action), array_merge(array(static::getParamName() => $identifier), $params), $absolute);
 }
开发者ID:blast007,项目名称:bzion,代码行数:14,代码来源:UrlModel.php

示例7: getHomeURL

 /**
  * Returns the path to the home page
  * @return string
  */
 protected function getHomeURL()
 {
     return Service::getGenerator()->generate('index');
 }
开发者ID:blast007,项目名称:bzion,代码行数:8,代码来源:HTMLController.php

示例8: redirectToList

 protected function redirectToList($model)
 {
     return new RedirectResponse(Service::getGenerator()->generate("index"));
 }
开发者ID:kleitz,项目名称:bzion,代码行数:4,代码来源:PageController.php

示例9: getMatchesURL

 /**
  * Get the URL that points to the team's list of matches
  *
  * @return string The team's list of matches
  */
 public function getMatchesURL()
 {
     return Service::getGenerator()->generate("match_by_team_list", array("team" => $this->getAlias()));
 }
开发者ID:allejo,项目名称:bzion,代码行数:9,代码来源:Team.php

示例10: redirectToList

 /**
  * Get a redirection response to a list of models
  *
  * @param  ModelInterface $model The model to whose list we should redirect
  * @return Response
  */
 protected function redirectToList($model)
 {
     $route = $model->getRouteName('list');
     $url = Service::getGenerator()->generate($route);
     return new RedirectResponse($url);
 }
开发者ID:allejo,项目名称:bzion,代码行数:12,代码来源:CRUDController.php

示例11: leaveAction

 public function leaveAction(Player $me, Group $discussion)
 {
     if (!$discussion->isMember($me)) {
         throw new ForbiddenException("You are not a member of this discussion.");
     } elseif ($discussion->getCreator()->getId() == $me->getId()) {
         throw new ForbiddenException("You can't abandon the conversation you started!");
     }
     return $this->showConfirmationForm(function () use($discussion, $me) {
         $discussion->removeMember($me);
         $event = new GroupAbandonEvent($discussion, $me);
         Service::getDispatcher()->dispatch(Events::GROUP_ABANDON, $event);
         return new RedirectResponse(Service::getGenerator()->generate('message_list'));
     }, "Are you sure you want to abandon this discussion?", "You will no longer receive messages from this conversation", "Leave");
 }
开发者ID:kleitz,项目名称:bzion,代码行数:14,代码来源:MessageController.php

示例12: __invoke

 /**
  * Modify the current page URL
  *
  * @param  array  $parameters An array of parameters to add/modify in the request
  * @return string The HTML link
  */
 public function __invoke(array $parameters)
 {
     $attributes = \Service::getRequest()->attributes;
     $query = \Service::getRequest()->query;
     return \Service::getGenerator()->generate($attributes->get('_route'), $parameters + $attributes->get('_route_params') + $query->all());
 }
开发者ID:allejo,项目名称:bzion,代码行数:12,代码来源:UrlModifyFunction.php

示例13: build

 /**
  * {@inheritDoc}
  */
 protected function build($builder)
 {
     return $builder->add('q', 'search')->setAction(\Service::getGenerator()->generate('message_search'))->setMethod('GET');
 }
开发者ID:kleitz,项目名称:bzion,代码行数:7,代码来源:MessageSearchFormCreator.php

示例14: setUpTwig

 private function setUpTwig()
 {
     $cacheDir = $this->isDebug() ? null : $this->getCacheDir() . '/twig';
     // Set up the twig templating environment to parse views
     $loader = new Twig_Loader_Filesystem(__DIR__ . '/../views');
     $twig = new Twig_Environment($loader, array('cache' => $cacheDir, 'debug' => $this->isDebug()));
     // Load the routing extension to twig, which adds functions such as path()
     $formEngine = new TwigRendererEngine(array('form_layout.html.twig'));
     $formEngine->setEnvironment($twig);
     $twig->addExtension(new RoutingExtension(Service::getGenerator()));
     $twig->addExtension(new FormExtension(new TwigRenderer($formEngine)));
     $twig->addExtension(new ImagineExtension($this->container->get('liip_imagine.cache.manager')));
     $twig->addExtension(new AssetExtension($this->container->get('assets.packages')));
     $twig->addExtension(new StopwatchExtension($this->container->get('debug.stopwatch', null)));
     if ($this->getEnvironment() == 'profile') {
         $twig->addExtension(new DumpExtension($this->container->get('var_dumper.cloner')));
     }
     $twig->addFunction(LinkToFunction::get());
     $twig->addFilter(HumanDateFilter::get());
     $twig->addFilter(TruncateFilter::get());
     $twig->addFilter(MarkdownFilter::get());
     $twig->addFilter(PluralFilter::get());
     $twig->addFilter(YesNoFilter::get());
     $twig->addTest(ValidTest::get());
     $twig->addTest(InvalidTest::get());
     if ($this->isDebug()) {
         $twig->addExtension(new Twig_Extension_Debug());
     }
     Service::setTemplateEngine($twig);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:30,代码来源:AppKernel.php

示例15: redirectTo

 protected function redirectTo($model)
 {
     // Redirect to the server list after creating/editing a role
     return new RedirectResponse(Service::getGenerator()->generate('admin_landing'));
 }
开发者ID:allejo,项目名称:bzion,代码行数:5,代码来源:RoleController.php


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