Commit 034d88e5 by Qiang Xue

Fixes issue #134

parent 3ca98d45
...@@ -412,7 +412,7 @@ class Customer extends \yii\db\ActiveRecord ...@@ -412,7 +412,7 @@ class Customer extends \yii\db\ActiveRecord
/** /**
* @param ActiveQuery $query * @param ActiveQuery $query
*/ */
public function active($query) public static function active($query)
{ {
$query->andWhere('status = 1'); $query->andWhere('status = 1');
} }
...@@ -435,7 +435,7 @@ class Customer extends \yii\db\ActiveRecord ...@@ -435,7 +435,7 @@ class Customer extends \yii\db\ActiveRecord
* @param ActiveQuery $query * @param ActiveQuery $query
* @param integer $age * @param integer $age
*/ */
public function olderThan($query, $age = 30) public static function olderThan($query, $age = 30)
{ {
$query->andWhere('age > :age', array(':age' => $age)); $query->andWhere('age > :age', array(':age' => $age));
} }
......
...@@ -88,7 +88,8 @@ class ActiveQuery extends Query ...@@ -88,7 +88,8 @@ class ActiveQuery extends Query
{ {
if (method_exists($this->modelClass, $name)) { if (method_exists($this->modelClass, $name)) {
array_unshift($params, $this); array_unshift($params, $this);
return call_user_func_array(array($this->modelClass, $name), $params); call_user_func_array(array($this->modelClass, $name), $params);
return $this;
} else { } else {
return parent::__call($name, $params); return parent::__call($name, $params);
} }
......
...@@ -22,6 +22,6 @@ class Customer extends ActiveRecord ...@@ -22,6 +22,6 @@ class Customer extends ActiveRecord
public static function active($query) public static function active($query)
{ {
return $query->andWhere('status=1'); $query->andWhere('status=1');
} }
} }
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