How do I access the caller model from a behavior in cakephp 3?
I need a caller model in my behavior to find and store the data. How can I do something like this.
class MyBehavior extends Behavior {
public function func() {
$entities = $this->find()->all();
}
+3
anghazi ghermezi
source
to share
1 answer
The instance of the table, reduced to the table, is passed to the constructor and assigned to the property $_table
.
public function func() {
$entities = $this->_table->find()->all();
}
See also API> Cake \ ORM \ Behavior :: $ _ table
+4
ndm
source
to share