[BUGFIX] Output dashed name for missing CLI arguments 25/34425/4
authorMathias Brodala <mbrodala@pagemachine.de>
Fri, 21 Nov 2014 07:59:33 +0000 (08:59 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Nov 2014 13:13:03 +0000 (14:13 +0100)
This changes the command argument name outputted on errors from variable
naming to dashed notation as used on the CLI.

Resolves: #61630
Releases: 6.2, master
Change-Id: Ie41c90c056505df859aec3ee306718c874dd8a05
Reviewed-on: http://review.typo3.org/34425
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Mvc/Controller/CommandController.php

index ff05983..60106fb 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extbase\Mvc\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
+use TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition;
 
 /**
  * A controller which processes requests from the command line
@@ -165,7 +166,8 @@ class CommandController implements CommandControllerInterface {
                        if ($this->request->hasArgument($argumentName)) {
                                $argument->setValue($this->request->getArgument($argumentName));
                        } elseif ($argument->isRequired()) {
-                               $exception = new \TYPO3\CMS\Extbase\Mvc\Exception\CommandException('Required argument "' . $argumentName . '" is not set.', 1306755520);
+                               $commandArgumentDefinition = $this->objectManager->get(CommandArgumentDefinition::class, $argumentName, TRUE, NULL);
+                               $exception = new \TYPO3\CMS\Extbase\Mvc\Exception\CommandException('Required argument "' . $commandArgumentDefinition->getDashedName() . '" is not set.', 1306755520);
                                $this->forward('error', 'TYPO3\\CMS\\Extbase\\Command\\HelpCommandController', array('exception' => $exception));
                        }
                }