li3_behaviors\data\model\Behaviors::__call()
Transfer call from the entity class to the behaviors. Concrete
behavior methods will receive the following parameters: $model
$behavior
and $entity
.
Parameters
-
string
$method
Method name caught by
__call()
. -
array
$params
Arguments given to the above
$method
call.
Returns
mixedSource
public function __call($method, $params) {
$model = get_called_class();
if (!isset(static::$_behaviors[$model])) {
return parent::__call($method, $params);
}
foreach (static::$_behaviors[$model] as $class => $behavior) {
if ($behavior->respondsTo($method)) {
array_unshift($params, $behavior);
array_unshift($params, $model);
return $behavior->invokeMethod($method, $params);
}
}
return parent::__call($method, $params);
}