Advanced functions for Active Record implementation in Yii Framework