Answer the question
In order to leave comments, you need to log in
ORM architecture. Passing table name?
The question is not about any specific ORM, but about the architecture in general.
There are options where you need to pass the table name directly in the query, for example:
$countries = $query->orderBy('code')
->where(['country.code' => '123'])
->count();
$customer = new Customer();
$customer->name = 'James';
$customer->email = '[email protected]';
$customer->save();
class Customer extends ORM{
protected $dbtable = 'my_clients'; // реальное имя таблицы БД задано на уровне класса
...
}
Answer the question
In order to leave comments, you need to log in
Usually the model is called with a single number, and the table in the plural with a small letter.
Those in the second case have the Customer model, the customers table. So for example done in eloquent in Laravel. If this does not suit you, then in normal ORMs you can always specify the table name manually, like you showed in the third case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question