4544fa8d
(Jaroslaw Janikowski)
1
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?
mdomba
(Maurizio Domba Cerin)
2
Hi
with() is used to specify relations… you most probably intended to use where() ?
shivam4u
(Shiv Charan Panjeta)
3
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]