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


PHP ControllerResolver::doGetArguments方法代码示例

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


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

示例1: doGetArguments

 protected function doGetArguments(Request $request, $controller, array $parameters)
 {
     foreach ($parameters as $param) {
         if ($param->getClass() && $param->getClass()->isInstance($this->app)) {
             $request->attributes->set($param->getName(), $this->app);
             break;
         }
     }
     return parent::doGetArguments($request, $controller, $parameters);
 }
开发者ID:nagi88,项目名称:controller-resolver-inject-constructor,代码行数:10,代码来源:DecoratorControllerResolverSymfony.php

示例2: doGetArguments

 protected function doGetArguments(Request $request, $controller, array $parameters)
 {
     /** @var \ReflectionParameter $param */
     foreach ($parameters as $param) {
         /** @var \Symfony\Component\Routing\Route $route */
         $route = $this->app['routes']->get($request->attributes->get('_route'));
         $bundle = $this->app->getSubBundle($route->getOption('bundle_name'));
         if ($bundle && $param->getClass() && $param->getClass()->isInstance($bundle)) {
             $request->attributes->set($param->getName(), $bundle);
             continue;
         }
         if ($param->getClass() && $param->getClass()->isInstance($this->app)) {
             $request->attributes->set($param->getName(), $this->app);
             continue;
         }
     }
     return parent::doGetArguments($request, $controller, $parameters);
 }
开发者ID:php-go,项目名称:php-go,代码行数:18,代码来源:ControllerResolver.php

示例3: doGetArguments

 /**
  * {@inheritdoc}
  */
 protected function doGetArguments(Request $request, $controller, array $parameters)
 {
     $arguments = parent::doGetArguments($request, $controller, $parameters);
     // The parameter converter overrides the raw request attributes with the
     // upcasted objects. However, it keeps a backup copy of the original, raw
     // values in a special request attribute ('_raw_variables'). If a controller
     // argument has a type hint, we pass it the upcasted object, otherwise we
     // pass it the original, raw value.
     if ($request->attributes->has('_raw_variables') && ($raw = $request->attributes->get('_raw_variables')->all())) {
         foreach ($parameters as $parameter) {
             // Use the raw value if a parameter has no typehint.
             if (!$parameter->getClass() && isset($raw[$parameter->name])) {
                 $position = $parameter->getPosition();
                 $arguments[$position] = $raw[$parameter->name];
             }
         }
     }
     return $arguments;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:22,代码来源:ControllerResolver.php

示例4: doGetArguments

 protected function doGetArguments(Request $request, $controller, array $parameters)
 {
     $args = $this->injectArguments($parameters, $request);
     foreach ($args as $key => $value) {
         $request->attributes->set($key, $value);
     }
     return parent::doGetArguments($request, $controller, $parameters);
 }
开发者ID:radvance,项目名称:radvance,代码行数:8,代码来源:ControllerResolver.php


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