1
我使用CakePHP的第一次和我的控制器中我需要切换我的模型的实例的属性的状态:阅读对象属性使用CakePHP
function toggleAutoMark($id = null) {
$this->Test->id = $id;
$this->Test->saveField('automark', !$this->Test->read('automark'));
$this->redirect(array('controller' => 'tests', 'action' => 'view', $id));
}
我不知道,如果我打算使用read()方法,但是这会返回一个数组(这不是我认为文档所说的)。
$this->Test->automark
不起作用,大概是因为该实例尚未加载。