Blame view

common/modules/relation/relationQueryTrait.php 878 Bytes
4253cbec   root   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  <?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']]);

      }*/

  }