/** * returns actions that was made by this user on some videos * @return ActiveQuery */ public function getVideoActions() { return $this->hasMany(VideoAction::className(), ['user_id' => 'id'])->where(['status' => 'active']); }
/** * @return \yii\db\ActiveQuery */ public function getVideoAction() { return $this->hasOne(VideoAction::className(), ['video_id' => 'id'])->where(['user_id' => Yii::$app->user->id])->all(); }