Probably stupid question

Well,

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

I do:

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

$user->delete();

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);

or:


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

Thank you!