public function init() { parent::init(); if ($this->id) { /** @var \common\models\Sound $sound */ $sound = \common\models\Sound::findOne($this->id); if ($sound && ($sound->public || Yii::$app->user->can('member'))) { $this->_sound = $sound; } } else { throw new InvalidParamException(Yii::t('front', 'No required parameter given') . ' - id'); } }