Bug #30491
Commands with only one optional argument don't work
| Status: | Closed | Start date: | 2011-09-30 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assigned To: | Robert Lemke | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Affected Flow version: |
Description
I kickstarted a command controller and added one command action with one optional argument:
[...]
class TestCommandController extends \TYPO3\FLOW3\MVC\Controller\CommandController {
/**
* Render the documentation for a specific package.
*
* @param string $packageKey The unique package key
* @return void
*/
public function renderCommand($packageKey = NULL) {
echo 'THIS IS '.$packageKey;
exit;
}
If I start the controller with:
./flow3 test:render TYPO3.TheDefinitiveGuideToFLOW3
it outputs:
THIS IS
If I make the argument $packageKey required everything works fine and de render command outputs:
THIS IS TYPO3.TheDefinitiveGuideToFLOW3
Bug or feature?
History
#1 Updated by Robert Lemke almost 4 years ago
- Status changed from New to Closed
Feature. The simple rule is: optional arguments must always be named.
The reason is that FLOW3 otherwise would not be able to distinguish between options and unnamed required arguments or exceeding arguments.