li3_behaviors\data\model\Behaviors::__callStatic()
Transfer static call to the behaviors first. Static behavior methods will get the name of the model as its first parameter and the instance of the behavior as a second paramter.
Parameters
-
string
$method
Method name caught by
__callStatic()
. -
array
$params
Arguments given to the above
$method
call.
Returns
mixedSource
public static function __callStatic($method, $params) {
$model = get_called_class();
if (!isset(static::$_behaviors[$model])) {
return parent::__callStatic($method, $params);
}
foreach (static::$_behaviors[$model] as $class => $behavior) {
if (method_exists($class, $method)) {
array_unshift($params, $behavior);
array_unshift($params, $model);
return call_user_func_array([$class, $method], $params);
}
}
return parent::__callStatic($method, $params);
}