Adapted to Yii2