Probably stupid question


I have a model "Users" of activeRecord type (made with gii).

I do:

$user = app\models\Users::find($id);


and I get the error:

"delete method was not found within class yii\db\ActiveQuery"

Well - what is the right way to delete records using activeRecord models?

I will appreciate prompt feedback :slight_smile:

$user = app\models\Users::findOne($id);


$user = app\models\Users::find()->where(['id' => $id])->one();

Thank you!