Neos\Flow\Mvc\ActionRequest::setControllerActionName PHP Метод

setControllerActionName() публичный Метод

Note that the action name must start with a lower case letter and is case sensitive.
public setControllerActionName ( string $actionName ) : void
$actionName string Name of the action to execute by the controller
Результат void
    public function setControllerActionName($actionName)
    {
        if (!is_string($actionName)) {
            throw new Exception\InvalidActionNameException('The action name must be a valid string, ' . gettype($actionName) . ' given (' . $actionName . ').', 1187176358);
        }
        if ($actionName === '') {
            throw new Exception\InvalidActionNameException('The action name must not be an empty string.', 1289472991);
        }
        if ($actionName[0] !== strtolower($actionName[0])) {
            throw new Exception\InvalidActionNameException('The action name must start with a lower case letter, "' . $actionName . '" does not match this criteria.', 1218473352);
        }
        $this->controllerActionName = $actionName;
    }

Usage Example

 /**
  * Determines the action method and assures that the method exists.
  *
  * @return string The action method name
  * @throws 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();
 }
All Usage Examples Of Neos\Flow\Mvc\ActionRequest::setControllerActionName