Fixes #1791.
Fixes #1791.
Merge branch 'master' of github.com:yiisoft/yii2

Conflicts:
	framework/yii/db/ActiveQuery.php
Fixed test break.
Further cleanup.