I have the following code (idk if i'm using it the right way or not):
$query = Model_Tmgroup_Member::query()
->select('*')
->where('tmgroup_id', '=', $group_id)
->where('tmuser_id', '=', $user_id);
return $query->get();
The model only has two columns ( the ones inside the ->where() )...
However, when running the query, it also looks for the column 'id' even though it does not exist in the model. The model had an 'id' column, which I deleted though.
Every ORM Model must have a primary key, and if you haven't set one, the model defaults to "id".
What is your intention with this model? This seems to be a relation table in a many-to-many relation between users and groups, which the ORM supports without having to define a model for that table?
Depending on the operation performed, the ORM sometimes sets a column to NULL before deleting a record, which fails in a spectacular way if you have constraints.
But you can leave them on, see if you run into this problem, and remove them only if you do?