protected function validateSourceData()
{
if (empty($this->query) || !$this->query instanceof ActiveQuery) {
throw new InvalidConfigException("The 'query' property must be defined and must be an instance of '" . ActiveQuery::className() . "'.");
}
$class = isset($this->query->modelClass) ? $this->query->modelClass : null;
if (empty($class) || !is_subclass_of($class, ActiveRecord::className())) {
throw new InvalidConfigException("The 'query' must be implemented using 'ActiveRecord::find()' method.");
}
$trait = 'kartik\\tree\\models\\TreeTrait';
if (!self::usesTrait($class, $trait)) {
throw new InvalidConfigException("The model class '{$class}' for the 'query' must use the trait '{$trait}' or extend from '" . Tree::className() . "''.");
}
}