I'm trying to fetch a record from the database using Eloquent CRM. My table's primary key field name is "user_id"
. The weird thing is that everytime i use User::find()
and pass a user_id
number, i get
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause'
(SQL: select * from `users` where `id` = ? limit 1) (Bindings: array ( 0 => 8, ))
I'm assuming the ORM makes calls assuming the table's id field name is "id"
instead of "user_id"
. How can i check that it correctly sees what it is supposed to see. I also tried to change the primary key field user_id to "id" as the ORM seem to expect and that worked but i'm following a naming convention in my database schema so i will like to stick to "user_id"
.
Any form of help will be appreciated.
Thanks