CakeResque没有加载模型

时间:2014-08-25 19:21:12

标签: model cakephp-2.0 scheduler

我使用http://cakeresque.kamisama.me/usage在Cakephp中创建后端作业。

我目前的设置是:

应用程序/控制台/命令/ AppShell.php

//AppShell.php

App::uses('Shell', 'Console');
App::uses('AppModel', 'Model');

class AppShell extends Shell
{

    public function perform()
    {
        $this->initialize();
        $this->loadTasks();
        $this->{array_shift($this->args)}();
    }

}

和file:app / Console / Command / UserShell.php

//UserShell.php
    App::uses('AppShell', 'Console/Command');
App::uses('User', 'Model');
class UserShell extends AppShell {

    public $uses = array('User');

    public function changePasswords(){

        $users = $this->User->fetchAll();
        .
        .
        .
    }
} 

但每次我到$ this-> User-> fetchAll();我收到错误

Database connection "Mysql" is missing, or could not be created.

我尝试以多种方式加载模型,数据库配置正确,因为主站点正常工作。

有什么想法吗?

0 个答案:

没有答案