如何从 cakephp 3 中的行为访问调用者模型?
How to access caller model from behavior in cakephp 3?
我的行为需要调用方模型来查找和保存数据。我怎么能做这样的事情。
class MyBehavior extends Behavior {
public function func() {
$entities = $this->find()->all();
}
行为附加到的 table 实例正在传递给构造函数,并分配给 $_table
属性.
public function func() {
$entities = $this->_table->find()->all();
}
我的行为需要调用方模型来查找和保存数据。我怎么能做这样的事情。
class MyBehavior extends Behavior {
public function func() {
$entities = $this->find()->all();
}
行为附加到的 table 实例正在传递给构造函数,并分配给 $_table
属性.
public function func() {
$entities = $this->_table->find()->all();
}