CLI Request Object not working |
Hello all,
I am struggling for a long time now with the CodeIgniter CLI classes. Unfortunately, the docs are anything but verbose there. What I need is call a controller from the command line with optional named, optional parameters. My route is PHP Code: $routes->cli('cron/makeactiontables', 'CLI\MakeActionTables::createActions'); And I call this route on the command line like this Code: php index.php cron makeactiontables --id=32654 My Controller looks like this PHP Code: <?php Code: [Error] The same happens when I extend from BaseController instead of Controller. The docs say Quote:If a request comes from a command line invocation, the request object is actually a CLIRequest. It behaves the same as a conventional request but adds some accessor methods for convenience. And it lists all these beautiful methods that I need but it does not seem to work. And yes, I know, the documentation also says Quote:It is recommended to use Spark Commands for CLI scripts instead of calling controllers via CLI However, I can't do that, really I can't, plus the above mentioned functions are there for a reason I thought Any idea what I am doing wrong? Or where I find a more in depth documentation and/or examples for this CLI stuff?
What version of CI4 do you use?
PHP Code: <?php PHP Code: $routes->cli('cron/makeactiontables', 'Home::index'); Code: $ php public/index.php cron makeactiontables --id=32654
It was a bug in v4.2.1, and fixed in v4.2.2.
Yes, using the latest version is good practice. Don't forget to check Upgrading Guide: https://codeigniter4.github.io/CodeIgnit...ading.html There might be breaking changes that break your app.
kenjisIt was a bug in v4.2.1, and fixed in v4.2.2.
Yes, using the latest version is good practice. Don't forget to check Upgrading Guide: https://codeigniter4.github.io/CodeIgnit...ading.html There might be breaking changes that break your app. Indeed there were a few, but nothing dramatic. Thanks again! |
Welcome Guest, Not a member yet? Register Sign In |