Answer the question
In order to leave comments, you need to log in
Writing to multiple tables (models) in Yii2. How to implement?
I am making an article module (with multilingualism) - according to this article habrahabr.ru/post/226931
Accordingly, I have two tables ".....
The post table (Post model) - we store meta-information that is not related to the content. That is the following fields: id, owner_id, date_create, date_update
Table post_lang(PostLang model) - content linking by language Fields: id, post_id, lang_id, name, description Accordingly, the post_id fields are id from the post table, lang_id is the id from tables lang. name and description - content in the corresponding language. ...."
How to write to two models at once when creating an article?
Those. I need to record information on creation in both Post and PostLang so that id.post = post_id.postlang.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question