I use public $uses = array('PluginA.ModelClass1');
to load the plugin model class in shell. And when I run the shell in command line, I got the following error:
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]
The shell and loaded model class are all in the plugin PluginA
. And in ModelClass1
, there is a method called exists()
.
Thanks in advance!