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

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

Sets the value of the specified argument
public setArgument ( string $argumentName, mixed $value ) : void
$argumentName string Name of the argument to set
$value mixed The new value
Результат void
    public function setArgument($argumentName, $value)
    {
        if (!is_string($argumentName) || strlen($argumentName) === 0) {
            throw new Exception\InvalidArgumentNameException('Invalid argument name (must be a non-empty string).', 1210858767);
        }
        if (substr($argumentName, 0, 2) === '__') {
            $this->internalArguments[$argumentName] = $value;
            return;
        }
        if (is_object($value)) {
            throw new Exception\InvalidArgumentTypeException('You are not allowed to store objects in the request arguments. Please convert the object of type "' . get_class($value) . '" given for argument "' . $argumentName . '" to a simple type first.', 1302783022);
        }
        if (substr($argumentName, 0, 2) === '--') {
            $this->pluginArguments[substr($argumentName, 2)] = $value;
            return;
        }
        switch ($argumentName) {
            case '@package':
                $this->setControllerPackageKey($value);
                break;
            case '@subpackage':
                $this->setControllerSubpackageKey($value);
                break;
            case '@controller':
                $this->setControllerName($value);
                break;
            case '@action':
                $this->setControllerActionName($value);
                break;
            case '@format':
                $this->setFormat($value);
                break;
            default:
                $this->arguments[$argumentName] = $value;
        }
    }

Usage Example

Пример #1
0
 /**
  * @return void
  * @internal
  */
 protected function processSubmittedFormValues()
 {
     $result = $this->mapAndValidatePage($this->lastDisplayedPage);
     if ($result->hasErrors() && !$this->userWentBackToPreviousStep()) {
         $this->currentPage = $this->lastDisplayedPage;
         $this->request->setArgument('__submittedArguments', $this->request->getArguments());
         $this->request->setArgument('__submittedArgumentValidationResults', $result);
     }
 }
All Usage Examples Of Neos\Flow\Mvc\ActionRequest::setArgument