I need caller model in my behavior to find and save data. How can I do something like this.
class MyBehavior extends Behavior {
public function func() {
$entities = $this->find()->all();
}
The table instance a behavior is attached to, is being passed to the constructor, and assigned to the $_table
property.
public function func() {
$entities = $this->_table->find()->all();
}
See also API > Cake\ORM\Behaviour::$_table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With