我正在开发 Cake 2.4,如果我在控制器中调试 $this,则 $this->Model 未设置但应该设置。
控制器:CustomersController(.php)
型号:CustomerModel(.php)
由于命名约定是正确的,我不知道问题出在哪里。
相关代码:
Customer.php:
<?php
class Customer extends Shop {
public $validate = array(/* ... */);
protected $_schema = array(/* ... */);
public function beforeSave($options = array()) {
parent::beforeSave($options);
}
}
CustomersController.php:
<?php
App::uses('ShopsController', 'Controller');
class CustomersController extends ShopsController {
public function beforeFilter() {
$this->Auth->allow('login');
parent::beforeFilter();
}
}