code: public function init()
      {
          $this->query = $this->controller->query;
          if ($this->query) {
              $modelClass = Yii::createObject($this->query->modelClass);
              $this->modelClass = $modelClass;
              $this->tableName = $modelClass::tableName();
          }
  
          parent::init(); // TODO: Change the autogenerated stub
      }
docs: Init query and modelClass
  @throws InvalidConfigException