[英]How can I call the 'log()' method from the beforeSave() method in a model in CakePHP?
How can I call the log() function inside the model beforeSave() function? 如何在模型的beforeSave()函数内部调用log()函数?
All three variants I used didn't work: 我使用的所有三个变体均无效:
function beforeSave() {
#...
Debugger::log($y.' '.$ty);
log('test');
$this->log('testmodel');
}
Ah! 啊! My model was named wrong and it never got called.
我的模型被命名错误,但从未被调用。 This works flawlessly:
这可以完美地工作:
$this->log($test);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.