models/CommentModel.php
public static function getAuthors()
    {
        $query = static::find()
            ->alias('c')
            ->select(['c.createdBy', 'a.username'])
            ->joinWith('author a')
            ->groupBy(['c.createdBy', 'a.username'])
            ->orderBy('a.username')
            ->asArray()
            ->all();

        return ArrayHelper::map($query, 'createdBy', 'author.username');
    }
public static function getAuthors()
    {
        $query = static::find()
            ->alias('c')
            ->select(['c.createdBy', 'a.username'])
            ->joinWith('author a')
            ->groupBy(['c.createdBy', 'a.username'])
            ->orderBy('a.username')
            ->asArray()
            ->all();

        return ArrayHelper::map($query, 'createdBy', 'author.username');
    }
public static function getAuthors ( ) { $ query = static :: find ( ) -> alias ( 'c' ) -> select ( [ 'c.createdBy' , 'a.username' ] ) -> joinWith ( 'author a' ) -> groupBy ( [ 'c.createdBy' , 'a.username' ] ) -> orderBy ( 'a.username' ) -> asArray ( ) -> all ( ) ; return ArrayHelper :: map ( $ query , 'createdBy' , 'author.username' ) ; }
Get list of all authors

@return array
Get list of all authors