[WIP] introduced activerecord activerelation and query traits

This is an experiment with traits to reduce duplicated code with different AR implementations.

We could raise minimum PHP version to 5.4 if we decide that this is a good way to go.

This PR shows the changes agains redis branch which is in PR #905.

Difference to master is here:

https://github.com/yiisoft/yii2/compare/master...redis-ar-traits