Db traits

- [x] Move commonly used functions of Query, ActiveQuery and ActiveRelation to traits
- [x] Make ActiveRelation class configurable in AR [diff](https://github.com/yiisoft/yii2/compare/db-traits#diff-9a0deee3cf55b88a2344fa079e80cd4cR96)
- [x] where to put the SORT_ASC and SORT_DESC constants?
- [x] adjust class and trait documentation

I created a BaseQuery in `yii\db` that supports `where`, `limit`, `offset`, `orderBy` and `indexBy`. These are imo the basic operations that have to be implemented by a dbms. This is also everything that is needed by dataprovider and gridview.