setting the table alias before applying scopes

this is to address this issue: https://github.com/yiisoft/yii/issues/1072 
what do you guys think?