Commit b3460fc3 by Qiang Xue

...

parent b3e6169a
...@@ -300,7 +300,7 @@ class ActiveFinder extends \yii\base\Object ...@@ -300,7 +300,7 @@ class ActiveFinder extends \yii\base\Object
} }
if ($config instanceof \Closure) { if ($config instanceof \Closure) {
call_user_func($config, $child->query); $config($child->query);
} else { } else {
foreach ($config as $name => $value) { foreach ($config as $name => $value) {
$child->query->$name = $value; $child->query->$name = $value;
......
...@@ -574,7 +574,7 @@ abstract class ActiveRecord extends Model ...@@ -574,7 +574,7 @@ abstract class ActiveRecord extends Model
} }
$relation = clone $relation; $relation = clone $relation;
if ($params instanceof \Closure) { if ($params instanceof \Closure) {
call_user_func($params, $relation); $params($relation);
} else { } else {
foreach ($params as $name => $value) { foreach ($params as $name => $value) {
$relation->$name = $value; $relation->$name = $value;
......
...@@ -77,7 +77,7 @@ class ArrayHelper ...@@ -77,7 +77,7 @@ class ArrayHelper
public static function get($array, $key, $default = null) public static function get($array, $key, $default = null)
{ {
if ($key instanceof \Closure) { if ($key instanceof \Closure) {
return call_user_func($key, $array, $default); return $key($array, $default);
} elseif (is_array($array)) { } elseif (is_array($array)) {
return isset($array[$key]) || array_key_exists($key, $array) ? $array[$key] : $default; return isset($array[$key]) || array_key_exists($key, $array) ? $array[$key] : $default;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment