Answer the question
In order to leave comments, you need to log in
What is the best way to organize a user model in Yii2?
Hello. There are several types of users with specific fields in the database (some users require a separate table, and the general data is stored in the user table), specific methods and relationships with other tables. I would like to be able to write like this:
$reader = Reader::findOne($id);
$books = $reader->books;
//..
$librarian = Librarian::findOne($id);
$orders = $librarian->orders;
$librarian->clearCart();
Answer the question
In order to leave comments, you need to log in
Has the issue been resolved? The issue is resolved through Relations
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question