Reputation: 9822
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 also 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?
Upvotes: 0
Views: 649
Reputation: 7465
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.
Upvotes: 1