Global scope and scopes


I have setup a global scope as follows in a global class which all ActiveRecord models extend from …

public static function find() {


	return parent::find()->where([static::tableName() . ".deleted" => 0]);



I have also setup a scope as follows …

public function isUser($userID = 0) {


	if($userID == 0)

		return $this->where([static::tableName() . ".fkIDWithUserID" => Yii::$app->user->id]);


		return $this->where([static::tableName() . ".fkIDWithUserID" => $userID]);



The problem is I cannot use the normal scope because the global scope returns ActiveQuery and not the ActiveRecord.

How can I use a global scope along with normal scopes. I use to be able to do this in Yii 1 but I cannot find a way to do it in Yii 2.

Any ideas?