InvalidParamException - Cant search by id.

hello I have sqlite3 database with one table and one row in it.

I want to find this row by executing:




MyActiveRecord::find()->with(['id' => 1])->one();

This code is throwing exception:


Invalid Parameter – yii\base\InvalidParamException

app\models\MyActiveRecord has no relation named "id".

Whats going on? My table has column id INTEGER PRIMARY_KEY. I have no relations in my table.

What this thing wants from me?

Hi

with() is used to specify relations… you most probably intended to use where() ?

try this.

[color=#660066]MyActiveRecord[/color][color=#666600]::[/color][color=#000000]find[/color]color=#666600->[/color][color=#000088]where[/color][color=#666600]([[/color][color=#008800]‘id’[/color][color=#000000] [/color][color=#666600]=>[/color][color=#000000] [/color][color=#006666]1[/color][color=#666600]])->[/color][color=#000000]one[/color]color=#666600;[/color]