A state machine behavior for Yii