public function getRelations(&$query, $table)
    {
        $relations = [];
        $columns = [];
        /** @var Module $module */
        $module = $this->module;
        if (isset($module->tables[$table]['relations'])) {
            $relations = $module->tables[$table]['relations'];
        }
        foreach ($relations as $relation => $relationParams) {
            $query->join(
                $relationParams['type'],
                $relationParams['table'] . ' ' . $relationParams['alias'],
                $relationParams['on']
            );
            $columns[] = $relationParams['alias'] . '.' . $relationParams['representive_columns'] . ' ' . $relation;
        }

        return $columns;
    }
public function getRelations(&$query, $table)
    {
        $relations = [];
        $columns = [];
        /** @var Module $module */
        $module = $this->module;
        if (isset($module->tables[$table]['relations'])) {
            $relations = $module->tables[$table]['relations'];
        }
        foreach ($relations as $relation => $relationParams) {
            $query->join(
                $relationParams['type'],
                $relationParams['table'] . ' ' . $relationParams['alias'],
                $relationParams['on']
            );
            $columns[] = $relationParams['alias'] . '.' . $relationParams['representive_columns'] . ' ' . $relation;
        }

        return $columns;
    }
public function getRelations ( & $ query , $ table ) { $ relations = [ ] ; $ columns = [ ] ; /** @var Module $module */ $ module = $ this -> module ; if ( isset ( $ module -> tables [ $ table ] [ 'relations' ] ) ) { $ relations = $ module -> tables [ $ table ] [ 'relations' ] ; } foreach ( $ relations as $ relation => $ relationParams ) { $ query -> join ( $ relationParams [ 'type' ] , $ relationParams [ 'table' ] . ' ' . $ relationParams [ 'alias' ] , $ relationParams [ 'on' ] ) ; $ columns [ ] = $ relationParams [ 'alias' ] . '.' . $ relationParams [ 'representive_columns' ] . ' ' . $ relation ; } return $ columns ; }
Adds join statement to basic query from relations declared in config files

@param \yii\db\Query $query
@param string $table
@return array $columns to select statement
Adds join statement to basic query from relations declared in config files