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
namespace App\Controllers\CLI;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Controller;
class MakeActionTables extends Controller {
public function __construct() {
}
public function createActions() {
print_r($this->request->getOptions());
return true;
The return is
Code:
[Error]
Call to undefined method CodeIgniter\HTTP\IncomingRequest::getOptions()
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?