I cannot find a simple concrete example of how to get an argument in the CakePHP 2 shell script.
class TestShell extends AppShell {
public function argumentTest(){
$parser = parent::getOptionParser();
$parser->addArgument('testArgument', array('short' => 't','help' => 'The test argument'));
var_dump($this->params);
}
}
Then I will try and name it:
Console / Cake TestShell argumentTest --t 45
Console / Cake TestShell argumentTest -t 45
Console / Cake TestShell argumentTest --testArgument 45
Console / Cake TestShell argumentTest -testArgument 45
with all of the above, I get this as an answer:
Usage:
cake lot_web_service [-h] [-v] [-q]
What am I doing wrong?
source
share