Skip to content

Commit 3699ee6

Browse files
author
Igor Chepurnoy
committed
Merge branch 'master' of github.com:yii2mod/yii2-comments
2 parents 3da2fc5 + 78f0ffd commit 3699ee6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 5.5
54
- 5.6
65
- 7.0
76

models/CommentModel.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public function getAvatar()
336336
return $this->author->getAvatar();
337337
}
338338

339-
return 'http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y&s=50';
339+
return 'http://www.gravatar.com/avatar?d=mm&f=y&s=50';
340340
}
341341

342342
/**
@@ -346,7 +346,16 @@ public function getAvatar()
346346
*/
347347
public static function getAuthors()
348348
{
349-
return ArrayHelper::map(static::find()->joinWith('author')->groupBy('createdBy')->asArray()->all(), 'createdBy', 'author.username');
349+
$query = static::find()
350+
->alias('c')
351+
->select(['c.createdBy', 'a.username'])
352+
->joinWith('author a')
353+
->groupBy(['c.createdBy', 'a.username'])
354+
->orderBy('a.username')
355+
->asArray()
356+
->all();
357+
358+
return ArrayHelper::map($query, 'createdBy', 'author.username');
350359
}
351360

352361
/**

0 commit comments

Comments
 (0)