我使用public $uses = array('PluginA.ModelClass1');
在shell中加载插件模型类。当我在命令行中运行shell时,我收到以下错误:
Mac:Console charles$ ./cake PluginA.do_something test CAMPAIGN -c 1
Notice Error: Undefined property: DoSomethingShell::$ModelClass1 in [/Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php, line 443]
PHP Fatal error: Call to a member function exists() on a non-object in /Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php on line 91
PHP Stack trace:
PHP 1. {main}() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:0
PHP 2. ShellDispatcher::run() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:37
PHP 3. ShellDispatcher->dispatch() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:68
PHP 4. Shell->runCommand() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:200
PHP 5. DoSomethingShell->test() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php:389
Fatal error: Call to a member function exists() on a non-object in /Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php on line 91
Call Stack:
0.0003 228248 1. {main}() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:0
0.0010 314344 2. ShellDispatcher::run() /Users/charles/Workspace/PHP/ProjectA/app/Console/cake.php:37
0.0153 2075240 3. ShellDispatcher->dispatch() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:68
0.0201 2416216 4. Shell->runCommand() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/ShellDispatcher.php:200
0.0262 3250056 5. DoSomethingShell->test() /Users/charles/Workspace/PHP/ProjectA/lib/Cake/Console/Shell.php:389
Fatal Error Error: Call to a member function exists() on a non-object in [/Users/charles/Workspace/PHP/ProjectA/app/Plugin/PluginA/Console/Command/DoSomethingShell.php, line 91]
shell和加载的模型类都在插件PluginA
中。在ModelClass1
中,有一种名为exists()
的方法。
提前致谢!