DynamicActiveQuery.php
public function prepare($builder)
    {
        /** @var DynamicActiveRecord $modelClass */
        $modelClass = $this->modelClass;
        $this->_dynamicColumn = $modelClass::dynamicColumn();

        if (empty($this->_dynamicColumn)) {
            /** @var string $modelClass */
            throw new \yii\base\InvalidConfigException(
                $modelClass . '::dynamicColumn() must return an attribute name'
            );
        }

        if (empty($this->select)) {
            $this->select[] = '*';
        }

        if (is_array($this->select) && in_array('*', $this->select)) {
            $db = $modelClass::getDb();
            $this->select[$this->_dynamicColumn] =
                'COLUMN_JSON(' . $db->quoteColumnName($this->_dynamicColumn) . ')';
        }

        return parent::prepare($builder);
    }
public function prepare($builder)
    {
        /** @var DynamicActiveRecord $modelClass */
        $modelClass = $this->modelClass;
        $this->_dynamicColumn = $modelClass::dynamicColumn();

        if (empty($this->_dynamicColumn)) {
            /** @var string $modelClass */
            throw new \yii\base\InvalidConfigException(
                $modelClass . '::dynamicColumn() must return an attribute name'
            );
        }

        if (empty($this->select)) {
            $this->select[] = '*';
        }

        if (is_array($this->select) && in_array('*', $this->select)) {
            $db = $modelClass::getDb();
            $this->select[$this->_dynamicColumn] =
                'COLUMN_JSON(' . $db->quoteColumnName($this->_dynamicColumn) . ')';
        }

        return parent::prepare($builder);
    }
public function prepare ( $ builder ) { /** @var DynamicActiveRecord $modelClass */ $ modelClass = $ this -> modelClass ; $ this -> _dynamicColumn = $ modelClass :: dynamicColumn ( ) ; if ( empty ( $ this -> _dynamicColumn ) ) { /** @var string $modelClass */ throw new \ yii \ base \ InvalidConfigException ( $ modelClass . '::dynamicColumn() must return an attribute name' ) ; } if ( empty ( $ this -> select ) ) { $ this -> select [ ] = '*' ; } if ( is_array ( $ this -> select ) && in_array ( '*' , $ this -> select ) ) { $ db = $ modelClass :: getDb ( ) ; $ this -> select [ $ this -> _dynamicColumn ] = 'COLUMN_JSON(' . $ db -> quoteColumnName ( $ this -> _dynamicColumn ) . ')' ; } return parent :: prepare ( $ builder ) ; }
Maria-specific preparation for building a query that includes a dynamic column.

@param \yii\db\QueryBuilder $builder

@return \yii\db\Query
@throws \yii\base\Exception
@throws \yii\base\InvalidConfigException
Maria - specific preparation for building a query that includes a dynamic column .