code: protected function createQuery($targetClass, $condition)
      {
          /* @var $targetClass \yii\db\ActiveRecordInterface */
          $query = $targetClass::find()->andWhere($condition);
          if ($this->filter instanceof \Closure) {
              call_user_func($this->filter, $query);
          } elseif ($this->filter !== null) {
              $query->andWhere($this->filter);
          }
  
          return $query;
      }
docs: Creates a query instance with the given condition.
  @param string $targetClass the target AR class
  @param mixed $condition query condition
  @return \yii\db\ActiveQueryInterface the query instance