Requestaction in a shell in cakephp 3.7

Hi, I’m moving an app from 2 to 3.7. In 2 I was using a shell to call a function in a controller via requestAction(), but can’t make it work on 3.7. I know I need to move away from a shell by 5.0, but don’t have the time to figure out how just now. My shell code in src/Shell/NotificationsShell.php is:-

<?php

namespace App\Shell;

use Cake\Console\Shell;
use Cake\Routing\RequestActionTrait;
class NotificationsShell extends Shell {
var $uses = array('User','Trip','Lunch');
function main() {
$this->layout = null;
$this->autoRender = false;
$this->requestAction('Notifications/notification');
}
}

and the error I get when running bin/cake Notifications is:-
Call to undefined method App\Shell\NotificationsShell::requestAction() in /home/probusgi/public_html/ProbusLive/src/Shell/NotificationsShell.php on line 12

Can anyone help please? TIA

KInd of solved, I managed to do what I wanted without requestaction.

Hi Peterg, tell how you solved the problem, the same thing happens to me, thanks.

I dropped shell and used command instead:

https://book.cakephp.org/3/en/console-and-shells/commands.html

The code now looks like:

NotificationsCommand.php
\NotificationsCommand.php
 1 <?php
 2 namespace App\Command;
 3 
 4 use Cake\Console\Arguments;
 5 use Cake\Console\Command;
 6 use Cake\Console\ConsoleIo;
 7 
 8 use App\Controller\NotificationsController;
 9 
10 class NotificationsCommand extends Command {
11     public function execute(Arguments $args, ConsoleIo $io) {
12         $this->layout = null;
13         $this->autoRender = false;
14         $Notifications = new NotificationsController();
15         $Notifications->notification();
16     }
17 }
18 
19