开发者

Migration CakePHP 1.2 -> 1.3 : Problem loading models

开发者 https://www.devze.com 2023-01-27 19:57 出处:网络
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 h

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号