I'm currently migrating a working app from CakePHP 1.2 to 1.3. Most things seem fine so far, except it appears that some models are not being loaded correctly in the app_controller.php. For example I have included the model 'message_thread.php' with
var $uses = array('MessageThread');
but when I try and
debug($this->MessageThread);
I get the error
Notice (8): Undefined property: ProjectsController::$MessageThread [APP/app_controller.php, line 415]
The model is als开发者_JS百科o loaded in the Projects controller, but I don't see why this is being called on a simple debug($this->MessageThread); call.
This problem has broken previously working code, so that
$this->MessageThread->create();
result in the following error
Fatal error: Call to a member function create() on a non-object in
any ideas?
You can load models into all controllers in the app controller as you are trying. Are you using php5? If so, tru using public instead of var when defining the array to see if the array is I heartier properly.
public $uses = array('MessageThread');
As per the other comments, it is best if you load models in each specific controller. Please let me know if this works.
精彩评论