I'm new with cakePHP 3. I have created a controller and model where I call a function to get all users from the database. But when I run the code below I will get the following error "Call to a member function get_all_users() on boolean".
what does this error means and how can I fix this up?
User.php (model)
namespace App\Model\Entity;
use Cake\ORM\Entity;
class User extends Entity {
public function get_all_users() {
// find users and return to controller
return $this->User->find('all');
}
}
UsersController.php (controller)
namespace App\Controller;
use App\Controller\AppController;
class UsersController extends AppController {
public function index() {
// get all users from model
$this->set('users', $this->User->get_all_users());
}
}