command-argument-dashed.patch

Show dashed command argument name - Mathias Brodala, 2014-09-16 11:41

Download (1.42 KB)

View differences:

typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php
66 66
	protected $reflectionService;
67 67

  
68 68
	/**
69
	 * @var \TYPO3\CMS\Extbase\Service\EnvironmentService
70
	 * @inject
71
	 */
72
	protected $environmentService;
73

  
74
	/**
69 75
	 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
70 76
	 */
71 77
	protected $objectManager;
......
165 171
			if ($this->request->hasArgument($argumentName)) {
166 172
				$argument->setValue($this->request->getArgument($argumentName));
167 173
			} elseif ($argument->isRequired()) {
174
				if ($this->environmentService->isEnvironmentInCliMode()) {
175
					$commandArgumentDefinition = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\CommandArgumentDefinition', $argumentName, TRUE, NULL);
176
					$argumentName = $commandArgumentDefinition->getDashedName();
177
				}
168 178
				$exception = new \TYPO3\CMS\Extbase\Mvc\Exception\CommandException('Required argument "' . $argumentName . '" is not set.', 1306755520);
169 179
				$this->forward('error', 'TYPO3\\CMS\\Extbase\\Command\\HelpCommandController', array('exception' => $exception));
170 180
			}