<?php

namespace common\modules\relation;

trait relationQueryTrait {

    static public $cache_tree = [];

    /** @var \yii\db\ActiveQuery $this */
    static $model;

    /*
     * @return \yii\db\ActiveQuery
     */
    private function getModel()
    {
        if (empty(self::$model)) {
            $class = $this->modelClass;
            self::$model = new $class;
        }
        return self::$model;
    }

    /*public function getRelations($relation) {
        $model = $this->getModel();

        $relation = $model->_getRelation($relation);
        return
            $model->owner
                ->hasMany($relation['outer']['model'], [$relation['outer']['key'] => $relation['outer']['linked_key']])
                ->viaTable($relation['linked_table'], [$relation['inner']['linked_key'] => $relation['inner']['key']]);
    }*/
}