當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。