Answer the question
In order to leave comments, you need to log in
How to add a record to 2 tables in yii2?
I created with gii table models.
1 table
id_shop
id_shop_value
id_shop_categor
2 table
id_shop_value
value
link It is
necessary that they are both filled when adding
value=
id_shop_value values but that auto-increment
and 2 table
id_shop_value=id_shop_value (from the first table)
id_shop but that auto-increment
Answer the question
In order to leave comments, you need to log in
Execute an INSERT query and write to at least 2, at least 5 tables.
PS The question could have been more detailed.
You create a model without a table, just for the form (like the standard ContactForm). In it, you create a save or saveAll () method and describe the save as you need in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question