Browse Source

Fixed the issue that Object/Component doesn't support using anonymous function as normal property values.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
84dd19d76f
  1. 5
      framework/yii/base/Component.php
  2. 5
      framework/yii/base/Object.php

5
framework/yii/base/Component.php

@ -193,9 +193,8 @@ class Component extends Object
*/ */
public function __call($name, $params) public function __call($name, $params)
{ {
$getter = 'get' . $name; if ($this->canGetProperty($name)) {
if (method_exists($this, $getter)) { $func = $this->$name;
$func = $this->$getter();
if ($func instanceof \Closure) { if ($func instanceof \Closure) {
return call_user_func_array($func, $params); return call_user_func_array($func, $params);
} }

5
framework/yii/base/Object.php

@ -155,9 +155,8 @@ class Object implements Arrayable
*/ */
public function __call($name, $params) public function __call($name, $params)
{ {
$getter = 'get' . $name; if ($this->canGetProperty($name)) {
if (method_exists($this, $getter)) { $func = $this->$name;
$func = $this->$getter();
if ($func instanceof \Closure) { if ($func instanceof \Closure) {
return call_user_func_array($func, $params); return call_user_func_array($func, $params);
} }

Loading…
Cancel
Save