/** * Initializes the arguments array of this controller by creating an empty argument object for each of the * method arguments found in the designated command method. * * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException * @return void */ protected function initializeCommandMethodArguments() { $methodParameters = $this->reflectionService->getMethodParameters(get_class($this), $this->commandMethodName); foreach ($methodParameters as $parameterName => $parameterInfo) { $dataType = NULL; if (isset($parameterInfo['type'])) { $dataType = $parameterInfo['type']; } elseif ($parameterInfo['array']) { $dataType = 'array'; } if ($dataType === NULL) { throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException('The argument type for parameter $' . $parameterName . ' of method ' . get_class($this) . '->' . $this->commandMethodName . '() could not be detected.', 1306755296); } $defaultValue = isset($parameterInfo['defaultValue']) ? $parameterInfo['defaultValue'] : NULL; $this->arguments->addNewArgument($parameterName, $dataType, $parameterInfo['optional'] === FALSE, $defaultValue); } }
/** * Initializes the arguments array of this controller by creating an empty argument object for each of the * method arguments found in the designated command method. * * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentTypeException * @return void * @throws InvalidArgumentTypeException */ protected function initializeCommandMethodArguments() { $methodParameters = $this->reflectionService->getMethodParameters(get_class($this), $this->commandMethodName); foreach ($methodParameters as $parameterName => $parameterInfo) { $dataType = null; if (isset($parameterInfo['type'])) { $dataType = $parameterInfo['type']; } elseif ($parameterInfo['array']) { $dataType = 'array'; } if ($dataType === null) { throw new InvalidArgumentTypeException(sprintf('The argument type for parameter $%s of method %s->%s() could not be detected.', $parameterName, get_class($this), $this->commandMethodName), 1306755296); } $defaultValue = isset($parameterInfo['defaultValue']) ? $parameterInfo['defaultValue'] : null; $this->arguments->addNewArgument($parameterName, $dataType, $parameterInfo['optional'] === false, $defaultValue); } }