loadModel in Shell


Hi there,

I made a Shell class which is working properly.
My problem is that I want to load a model called “Tasks”. Only this gives a problem when using $this->Tasks which is already reserved for Shell Tasks. Does anyone knows a work-around?


I suppose you’re using CakePHP 3, so you can load the model with:

$this->Tasks = \Cake\ORM\TableRegistry::get('Tasks');

That’s it!


You can use ModelAwareTrait anywhere to get loadModel function


You can directly use $this->loadModel('Tables');.