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


PHP ActionRequest::setControllerActionName方法代码示例

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


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

示例1: resolveActionMethodName

 /**
  * Determines the action method and assures that the method exists.
  *
  * @return string The action method name
  * @throws \TYPO3\Flow\Mvc\Exception\NoSuchActionException if the action specified in the request object does not exist (and if there's no default action either).
  */
 protected function resolveActionMethodName()
 {
     if ($this->request->getControllerActionName() === 'index') {
         $actionName = 'index';
         switch ($this->request->getHttpRequest()->getMethod()) {
             case 'HEAD':
             case 'GET':
                 $actionName = $this->request->hasArgument($this->resourceArgumentName) ? 'show' : 'list';
                 break;
             case 'POST':
                 $actionName = 'create';
                 break;
             case 'PUT':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'update';
                 break;
             case 'DELETE':
                 if (!$this->request->hasArgument($this->resourceArgumentName)) {
                     $this->throwStatus(400, NULL, 'No resource specified');
                 }
                 $actionName = 'delete';
                 break;
         }
         $this->request->setControllerActionName($actionName);
     }
     return parent::resolveActionMethodName();
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:35,代码来源:RestController.php

示例2: setDefaultControllerAndActionNameIfNoneSpecified

 /**
  * Set the default controller and action names if none has been specified.
  *
  * @return void
  */
 protected function setDefaultControllerAndActionNameIfNoneSpecified()
 {
     if ($this->actionRequest->getControllerName() === NULL) {
         $this->actionRequest->setControllerName('Standard');
     }
     if ($this->actionRequest->getControllerActionName() === NULL) {
         $this->actionRequest->setControllerActionName('index');
     }
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:14,代码来源:Router.php

示例3: actionRequestStripsParentHttpRequest

 /**
  * @test
  */
 public function actionRequestStripsParentHttpRequest()
 {
     $httpRequest = Request::create(new Uri('http://typo3.org'));
     $actionRequest = new ActionRequest($httpRequest);
     $actionRequest->setControllerActionName('foo');
     $serializedActionRequest = serialize($actionRequest);
     /* @var $unserializedActionRequest ActionRequest */
     $unserializedActionRequest = unserialize($serializedActionRequest);
     $this->assertNull($unserializedActionRequest->getParentRequest(), 'Parent HTTP request should be NULL after deserialization');
     $this->assertSame('foo', $unserializedActionRequest->getControllerActionName());
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:14,代码来源:ActionRequestTest.php

示例4: indexAction

 /**
  * @param array $module
  * @return mixed
  */
 public function indexAction(array $module)
 {
     $moduleRequest = new ActionRequest($this->request);
     $moduleRequest->setArgumentNamespace('moduleArguments');
     $moduleRequest->setControllerObjectName($module['controller']);
     $moduleRequest->setControllerActionName($module['action']);
     if (isset($module['format'])) {
         $moduleRequest->setFormat($module['format']);
     }
     if ($this->request->hasArgument($moduleRequest->getArgumentNamespace()) === true && is_array($this->request->getArgument($moduleRequest->getArgumentNamespace()))) {
         $moduleRequest->setArguments($this->request->getArgument($moduleRequest->getArgumentNamespace()));
     }
     foreach ($this->request->getPluginArguments() as $argumentNamespace => $argument) {
         $moduleRequest->setArgument('--' . $argumentNamespace, $argument);
     }
     $modules = explode('/', $module['module']);
     $moduleConfiguration = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $modules));
     $moduleConfiguration['path'] = $module['module'];
     if (!$this->menuHelper->isModuleEnabled($moduleConfiguration['path'])) {
         throw new DisabledModuleException(sprintf('The module "%s" is disabled. You can enable it with the "enabled" flag in Settings.yaml.', $module['module']), 1437148922);
     }
     $moduleBreadcrumb = array();
     $path = array();
     foreach ($modules as $moduleIdentifier) {
         array_push($path, $moduleIdentifier);
         $config = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $path));
         $moduleBreadcrumb[implode('/', $path)] = $config;
     }
     $moduleRequest->setArgument('__moduleConfiguration', $moduleConfiguration);
     $moduleResponse = new Response($this->response);
     $this->dispatcher->dispatch($moduleRequest, $moduleResponse);
     if ($moduleResponse->hasHeader('Location')) {
         $this->redirectToUri($moduleResponse->getHeader('Location'), 0, $moduleResponse->getStatusCode());
     } elseif ($moduleRequest->getFormat() !== 'html') {
         $mediaType = MediaTypes::getMediaTypeFromFilename('file.' . $moduleRequest->getFormat());
         if ($mediaType !== 'application/octet-stream') {
             $this->controllerContext->getResponse()->setHeader('Content-Type', $mediaType);
         }
         return $moduleResponse->getContent();
     } else {
         $user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
         $sites = $this->menuHelper->buildSiteList($this->controllerContext);
         $this->view->assignMultiple(array('moduleClass' => implode('-', $modules), 'moduleContents' => $moduleResponse->getContent(), 'title' => $moduleRequest->hasArgument('title') ? $moduleRequest->getArgument('title') : $moduleConfiguration['label'], 'rootModule' => array_shift($modules), 'submodule' => array_shift($modules), 'moduleConfiguration' => $moduleConfiguration, 'moduleBreadcrumb' => $moduleBreadcrumb, 'user' => $user, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $sites));
     }
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:49,代码来源:ModuleController.php

示例5: passArgumentsToSubRequest

 /**
  * Pass the arguments of the widget to the sub request.
  *
  * @param ActionRequest $subRequest
  * @return void
  */
 private function passArgumentsToSubRequest(ActionRequest $subRequest)
 {
     $arguments = $this->controllerContext->getRequest()->getPluginArguments();
     $widgetIdentifier = $this->widgetContext->getWidgetIdentifier();
     $controllerActionName = 'index';
     if (isset($arguments[$widgetIdentifier])) {
         if (isset($arguments[$widgetIdentifier]['@action'])) {
             $controllerActionName = $arguments[$widgetIdentifier]['@action'];
             unset($arguments[$widgetIdentifier]['@action']);
         }
         $subRequest->setArguments($arguments[$widgetIdentifier]);
     }
     if ($subRequest->getControllerActionName() === null) {
         $subRequest->setControllerActionName($controllerActionName);
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:22,代码来源:AbstractWidgetViewHelper.php

示例6: setControllerActionNameThrowsExceptionOnInvalidActionNames

 /**
  * @test
  * @param mixed $invalidActionName
  * @dataProvider invalidActionNames
  * @expectedException \TYPO3\Flow\Mvc\Exception\InvalidActionNameException
  */
 public function setControllerActionNameThrowsExceptionOnInvalidActionNames($invalidActionName)
 {
     $this->actionRequest->setControllerActionName($invalidActionName);
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:10,代码来源:ActionRequestTest.php

示例7: setDefaultControllerAndActionNameIfNoneSpecified

 /**
  * Set the default controller and action names if none has been specified.
  *
  * @param ActionRequest $actionRequest
  * @return void
  */
 protected function setDefaultControllerAndActionNameIfNoneSpecified(ActionRequest $actionRequest)
 {
     if ($actionRequest->getControllerName() === null) {
         $actionRequest->setControllerName('Standard');
     }
     if ($actionRequest->getControllerActionName() === null) {
         $actionRequest->setControllerActionName('index');
     }
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:15,代码来源:DispatchComponent.php

示例8: setControllerActionNameThrowsExceptionOnInvalidActionNames

 /**
  * @test
  * @dataProvider invalidActionNames
  * @expectedException TYPO3\Flow\Mvc\Exception\InvalidActionNameException
  */
 public function setControllerActionNameThrowsExceptionOnInvalidActionNames($invalidActionName)
 {
     $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
     $actionRequest = new ActionRequest($httpRequest);
     $actionRequest->setControllerActionName($invalidActionName);
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:11,代码来源:ActionRequestTest.php


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