public static function getListQuery( ?array $condition = [], $key = null, $value = null, $indexBy = true, $orderBy = true, $alias = null )
	{
		
		if( !$alias && is_subclass_of( get_called_class(), ActiveRecord::class ) ) {
			$table = Yii::$app->db->schema->getRawTableName( ( get_called_class() )::tableName() );
		}
		else if( $alias ) {
			$table = $alias;
		}
		else {
			$table = '';
		}
		
		!$table ?: $table .= '.';
		
		$key   = $key ?? static::primaryKey()[0];
		$value = $value ?? $key;
		
		$query = static::find()
		               ->select( [
			               $table . $value,
			               $table . $key,
		               ] )
		               ->andFilterWhere( $condition ?? [] )
		;
		
		if( $orderBy === true ) { //
			$query->orderBy( $table . $value );
		}
		else if( $orderBy !== false ) { //
			$query->orderBy( $table . $orderBy );
		}
		
		if( $indexBy === true ) { //
			$query->indexBy( $key );
		}
		else if( $indexBy !== false ) { //
			$query->indexBy( $indexBy );
		}
		
		return $query;
	}
public static function getListQuery( ?array $condition = [], $key = null, $value = null, $indexBy = true, $orderBy = true, $alias = null )
	{
		
		if( !$alias && is_subclass_of( get_called_class(), ActiveRecord::class ) ) {
			$table = Yii::$app->db->schema->getRawTableName( ( get_called_class() )::tableName() );
		}
		else if( $alias ) {
			$table = $alias;
		}
		else {
			$table = '';
		}
		
		!$table ?: $table .= '.';
		
		$key   = $key ?? static::primaryKey()[0];
		$value = $value ?? $key;
		
		$query = static::find()
		               ->select( [
			               $table . $value,
			               $table . $key,
		               ] )
		               ->andFilterWhere( $condition ?? [] )
		;
		
		if( $orderBy === true ) { //
			$query->orderBy( $table . $value );
		}
		else if( $orderBy !== false ) { //
			$query->orderBy( $table . $orderBy );
		}
		
		if( $indexBy === true ) { //
			$query->indexBy( $key );
		}
		else if( $indexBy !== false ) { //
			$query->indexBy( $indexBy );
		}
		
		return $query;
	}
public static function getListQuery ( ? array $ condition = [ ] , $ key = null , $ value = null , $ indexBy = true , $ orderBy = true , $ alias = null ) { if ( ! $ alias && is_subclass_of ( get_called_class ( ) , ActiveRecord :: class ) ) { $ table = Yii :: $ app -> db -> schema -> getRawTableName ( ( get_called_class ( ) ) :: tableName ( ) ) ; } else if ( $ alias ) { $ table = $ alias ; } else { $ table = '' ; } ! $ table ? : $ table .= '.' ; $ key = $ key ?? static :: primaryKey ( ) [ 0 ] ; $ value = $ value ?? $ key ; $ query = static :: find ( ) -> select ( [ $ table . $ value , $ table . $ key , ] ) -> andFilterWhere ( $ condition ?? [ ] ) ; if ( $ orderBy === true ) { // $ query -> orderBy ( $ table . $ value ) ; } else if ( $ orderBy !== false ) { // $ query -> orderBy ( $ table . $ orderBy ) ; } if ( $ indexBy === true ) { // $ query -> indexBy ( $ key ) ; } else if ( $ indexBy !== false ) { // $ query -> indexBy ( $ indexBy ) ; } return $ query ; }
Return records as Array id => column for dropdowns

@param $key
@param $value
@param bool $orderBy
@return array
Return records as Array id = > column for dropdowns